This is my first question posting so sorry if I make make any faux pas'
Using C
In my program I create a global variable pointer
double *correlationData;
In main I create this local variable:
int arrayLength = 0;
in main I have an if statement inside a for loop which contains
arrayLength++;
after the for loop I initiate an array and assign it to the pointer
double correlationArray[arrayLength];
correlationData = correlationArray;
but I get a "segmentation fault" at this part of the code and I can't figure out why. If I print out arrayLength it is 1900000. First I thought maybe this was too big for an array so I tried
correlationData = correlationArray[1900000];
and that worked without any errors. Why I am getting this error?