If I defined a char buffer like below
char buffer[20] = "foo";
then
buffer[0] == 'f';
buffer[1] == 'o';
buffer[2] == 'o';
buffer[3] == 0;
What does the standard say about buffer[4] to buffer[19]. Are they guaranteed to be intialized to zero as well ?
All remaining elements guaranteed to be intialized to zero.
Reference:
C++03 Standard section 6.7.8 para 21: