D
diegotorquemada
Hello all,
According to:
http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Initializing-Arrays
In that sense my_array[4] is indeterminate (provided it is not static)
Then why often you see in some other places (see e.g. http://c-faq.com/decl/initval.html) that
int my_array[5] = { 0 };
will initialize all the array to zero?
Is the GNU link wrong?
Thank you very much and kind regards,
Diego Andrés
According to:
http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Initializing-Arrays
You don't have to initialize all of the array elements. For example, this code initializes only the first three elements:
int my_array[5] = { 0, 1, 2 };
Items that are not explicitly initialized will have an indeterminate value unless the array is of static storage duration.
In that sense my_array[4] is indeterminate (provided it is not static)
Then why often you see in some other places (see e.g. http://c-faq.com/decl/initval.html) that
int my_array[5] = { 0 };
will initialize all the array to zero?
Is the GNU link wrong?
Thank you very much and kind regards,
Diego Andrés