in c, when declare array:
char myarray[100] = { 0 };
what value inserted array's elements?
is possible fill null
s?
in case, elements initialized null character '\0'
.
c11-§6.7.9/21:
if there fewer initializers in brace-enclosed list there elements or members of aggregate, or fewer characters in string literal used initialize array of known size there elements in array, remainder of aggregate shall initialized implicitly same objects have static storage duration.
and paragraph 10 says
[...] if object has static or thread storage duration not initialized explicitly, then:
— if has pointer type, initialized null pointer;
— if has arithmetic type, initialized (positive or unsigned) zero;
— if aggregate, every member initialized (recursively) according these rules, , padding initialized 0 bits;
— if union, first named member initialized (recursively) according these rules, , padding initialized 0 bits;
is possible fill nulls?
null
macro used null pointers , not null characters.
Comments
Post a Comment