Is there a way to declare first and then initialize an array in C?
So far I have been initializing an array like this:
int myArray[SIZE] = {1,2,3,4..
Is there a way to declare first and then initialize an array in C?
There is! but not using the method you described.
You can't initialize with a comma separated list, this is only allowed in the declaration. You can however initialize with...
myArray[0] = 1;
myArray[1] = 2;
...
or
for(int i = 1; i <= SIZE; i++)
{
myArray[i-1] = i;
}