Randi Botse wrote: > >> Sorry but, i just having another question, consider this code: > >> > >> const char *my_strings[] = { > >> [0] = "index0", > >> [4] = "index4", > >> [6] = "index6" > >> }; > > > > NULLs will be written at indexes 1, 2, 3 and 5. There will be total of > > 7 pointers (the last one will point to "index6"). > > That's clear now, i was though the 'unindexed' strings (in this case > index 1, 2, 3, and 5) remains unintialized (not initialized to NULL). If you specify an initialiser, the entire object is initialised. If you specify an incomplete initialiser, the unspecified elements are initialised to the appropriate zero value (0, 0.0, '\0', NULL, etc). The C99 standard says (6.7.8p21): [#21] If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration. This applies to both traditional C89 sequential initialisers and C99 designated initialisers. It allows you to initialise large arrays or structures without having to specify every element; e.g.: int array[1000] = {0}; struct foo f = {0}; will initialise the entire array or structure to zero. -- Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html