...
STR36-EX1: If the intention is to create an character array and not a null-terminated byte string, initializing to fit exactly without a null byte is allowed but not recommended. The preferred approach to create an array containing just the three characters, 'a'
, 'b'
, and 'c'
, for example, is to declare each character literal as a separate element as follows:
Code Block | ||
---|---|---|
| ||
char s[3] = { 'a', 'b', 'c' }; |
...