Ravi Uday wrote:
[...]
Nope since 'newvar' is declared as char newvar[3] = "0";
all its array elements are initialized to zero
Minor quibble: the first one is initialised to '0' (the
implementation's integral representation of character zero).
C89 -
3.5.7 Initialization
An array of character type may be initialized by a character string
literal, optionally enclosed in braces. Successive characters of the
character string literal (including the terminating null character if
there is room or if the array is of unknown size) initialize the
members of the array.
You might have wanted to complete that reasoning with this later
paragraph (N869):
If there are fewer initializers 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.
And this prior paragraph:
If an object that has static storage duration is not initialized
explicitly, then:
...
-- if it has arithmetic type, it is initialized to (positive or
unsigned) zero;