You can allocate it outside the loop. This will create array on the heap, which is capable of handling much larger array sizes (among other things). The only problem is that you have to remember to free it once you're done, otherwise the heap gets cluttered and your program might crash.
#include <stdlib.h> float *array = malloc(2500000 * sizeof(float)); /* Do anything you need to in here, and make sure you free `array` as soon as you're done with it. */ free(array); /* `array` is gone, you can't use it again unless you reallocate it again using malloc. */Go to the full post