Defect Report #092

Submission Date: 03 Dec 93
Submittor: WG14
Source: Clive Feather
Question
Item 29 - partial initialization of strings
Consider the following program:
#include <stdio.h>

int main (void)
{
char s [10] = "Hello";

printf ("s [9] is %d\n", s [9]);
return 0;
}

Is this program strictly conforming? If so, is the value of s[9] guaranteed to be zero? Subclause 6.5.7 states:
If there are fewer initializers in a brace-enclosed list than there are members of an aggregate, the remainder of the aggregate shall be initialized the same as objects that have static storage duration.
However, the initializer is not brace-enclosed, so this clause does not apply.
Response
See the response to Defect Report #060.
Previous Defect Report < - > Next Defect Report