[dcl.init.string] (original) (raw)
An array of ordinary character type ([basic.fundamental]),char8_t array,char16_t array,char32_t array, or wchar_t array can be initialized by an ordinary string literal, UTF-8 string literal, UTF-16 string literal, UTF-32 string literal, or wide string literal, respectively, or by an appropriately-typed string-literal enclosed in braces ([lex.string]).
Successive characters of the value of the string-literalinitialize the elements of the array.
[Example 1:
char msg[] = "Syntax error on line %s\n";shows a character array whose members are initialized with astring-literal.
Note that because'\n'is a single character and because a trailing'\0'is appended,sizeof(msg)is25.
— _end example_]