Initializing Character Arrays
In C++, when you initialize character arrays, a
trailing '\0' (zero of type char) is appended to the string initializer.
You cannot initialize a character array with more initializers than
there are array elements.
In ISO C, space for the trailing '\0' can be omitted in this
type of information.
For example, the following initialization is not valid in
C++:
char v[3] = "asd"; //not valid in C++, valid in ISO C
//because four elements are requiredThis initialization produces an error because there is no space
for the implied trailing '\0' (zero of type char). The following initialization,
for instance, is valid in C++:
char v[4] = "asd"; //valid in C++Note: For more detailed information on compatibility, see the ILE C/C++
Language Reference.