In case you don't know the memory amount the program needs, dynamic allocation of memory should be used.
Thus, instead of static memory allocation:
int array[10];you should use dynamic allocation:
int *array = NULL;
array = malloc(n*sizeof(int));where n is size of an array determined while executing the program.