Possible Duplicate:
Max Array Size in C
My question is: Does Code::blocks have a max number of iterations for a loop?
I am running a monte carlo and I would like to run a million particles through a for loop. But the max it seems to go without crashing is 110000.
Thanks!
Some more info:
I am using a random number generator seeded by time:
srand(time(NULL));
I then want to create a million particles (random)
for(k=0; k<M; k++){
R[k] = rand()*(1)/(double)RAND_MAX;
z[k] = -log(1 - R[k])/(1000*U);
where M = Num/10 (I want to #define N 1000000)
This is the only thing I can think of that is creating the problem?
Here is an example code that will not work.
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
int main(){
srand(time(NULL));
int j=0;
int i;
double A[1000000];
for(i=0;i<1000000;i++){
A[i] = rand()*(1.0)/(double)RAND_MAX;
if (A[i] == 1.0){
printf("Wow!\n");
}
}
return 0;
}
Could this be due to my settings of Code::blocks by any chance?