Home > Back-end >  A c
A c

Time:01-13

Why char STR []={' c ', 'h', 'n'} do string, and the char STR [9]={' c ', 'h', 'n'} can do

CodePudding user response:

Help!!!!!!

CodePudding user response:

Char STR []={' c ', 'h', 'n'}; Initialize a character array, element number 3, the last element is' n 'not' \ 0 '
Char STR [9]={' c ', 'h', 'n'}; Initialize a character array, element number 9, for the first three characters' c ', 'h', 'n', then 6 characters of the default initialized to '\ 0', so you can as content is "CHN" string