char s[ ]="Hello!" char s[ ]={'H','e','l','l','o'''!'}长度分别是多少?char s[ ]={'H','e','l','l','o'''!'}是字符数组,长度为6char s[ ]="Hello!" 为字符串,有7个元素,因为最后一个字符串结束符\0不计入长度,所以长度

来源:学生作业帮助网 编辑:六六作业网 时间:2024/05/15 02:14:08
chars[]="Hello!"chars[]={''H'',''e'',''l'',''l'',''o''''''!''}长度分别是多少?chars[]={''H'',''e'',''l'',''l'',''o''''''!''}是字符数组,长度为6

char s[ ]="Hello!" char s[ ]={'H','e','l','l','o'''!'}长度分别是多少?char s[ ]={'H','e','l','l','o'''!'}是字符数组,长度为6char s[ ]="Hello!" 为字符串,有7个元素,因为最后一个字符串结束符\0不计入长度,所以长度
char s[ ]="Hello!" char s[ ]={'H','e','l','l','o'''!'}长度分别是多少?
char s[ ]={'H','e','l','l','o'''!'}是字符数组,长度为6
char s[ ]="Hello!" 为字符串,有7个元素,因为最后一个字符串结束符\0不计入长度
,所以长度也为6

char s[ ]="Hello!" char s[ ]={'H','e','l','l','o'''!'}长度分别是多少?char s[ ]={'H','e','l','l','o'''!'}是字符数组,长度为6char s[ ]="Hello!" 为字符串,有7个元素,因为最后一个字符串结束符\0不计入长度,所以长度
char s[ ]={'H','e','l','l','o'''!'};是字符数组,元素个数为6,因为不以\0结尾,strlen(s)的值不确定.
char s[ ]="Hello!" 为字符串,有7个元素,因为最后一个字符串结束符\0不计入长度
,所以strlen(s)=6.