K
Kannan
Hi,
I have question about character array initialization. In section 6.7.8
paragraph number 21, it's given that
"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."
My question is that, if I declare
char sTemp[5] = "";
Is it GUARANTEED that all the five elements of the array will be
initialized to '\0'? Or is it only guarantees that that sTemp[0] will
be initialized to '\0'?
Any help greatly appreciated.
Thank you for your time.
-Kannan
I have question about character array initialization. In section 6.7.8
paragraph number 21, it's given that
"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."
My question is that, if I declare
char sTemp[5] = "";
Is it GUARANTEED that all the five elements of the array will be
initialized to '\0'? Or is it only guarantees that that sTemp[0] will
be initialized to '\0'?
Any help greatly appreciated.
Thank you for your time.
-Kannan