下列数组不是字符串的是()。
A: char a[]="China";
B: char a[5]={'C','h','i','n','a'};
C: char a[6]={'C','h','i','n','a','\0'};
D: char a[7]={'C','h','i','n','a'};
A: char a[]="China";
B: char a[5]={'C','h','i','n','a'};
C: char a[6]={'C','h','i','n','a','\0'};
D: char a[7]={'C','h','i','n','a'};
举一反三
- char str[]=“China”; 等价于 A: char str[5]={‘C’, ‘h’, ‘i’, ‘n’, ‘a’,’0’}; B: char str[6]={‘C’, ‘h’, ‘i’, ‘n’, ‘a’,’0’}; C: char str[5]={‘C’, ‘h’, ‘i’, ‘n’, ‘a’}; D: char str[6]={‘C’, ‘h’, ‘i’, ‘n’, ‘a’};
- 下列数组不是字符串的是()。 A: char b[]="hi"; B: char b[5]="a"; C: char b[6]={'C','h','i','n','a','\0'}; D: char b[5]={'C','h','i','n','a'}
- 06410011:与char str[]={“china”};初始化赋值不等价的是( )。 A: char str[]=“china”; B: char str[6]={‘c’,’h’,’i’,’n’,’a’,’\o’}; C: char str[]={‘c’,’h’,’i’,’n’,’a’,’\o’}; D: char str[]={‘c’,’h’,’i’,’n’,’a’};
- 与如下代码不等价的语句是________。 char str[ ] = "china"; A: char str[6] = “china”; B: char str[ ] = {'c', 'h', 'i', 'n', 'a'}; C: char str[ ] = {'c', 'h', 'i', 'n', 'a', '\0'}; D: char str[ ] = {"china"};
- 下列字符数组的定义和初始化中错误的是( )。 A: char s1[]="china"; B: char s2[]={"china"}; C: char s3[5]="china"; D: char s4[5]={'c','h','i','n','a'};