Originally Posted by
nkrao123@gmail.
please can you tell once this?
I think we already have at least two or three times. The "variable length" feature in c99 -- the 1999 ANSI C standard -- allows you to declare an array with a variable length.
However, no C standard allows you to initialize such an object with values. You cannot do that, period, end of story.
Here are two declarations:
Code:
int x;
int array[n];
These variables have not been initialized; they could have any value in them.
Now x has been initialized. It could have been initialized in the declaration:
An array of fixed length can also be initialized in its declaration:
Code:
int array[3] = {4, 5, 666};
However, you cannot:
1) initialize an array after its declaration; you must assign to individual elements.*
2) initialize a variable length array, such as "int array[n]"
Read posts #14 and #15 again if you still do not understand what this means. If you want to put values into a variable length array, you have to do so after the declaration.
* actually you can set more than one at time with memset().