与如下代码不等价的语句是________。 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 str[6] = “china”;
B: char str[ ] = {'c', 'h', 'i', 'n', 'a'};
C: char str[ ] = {'c', 'h', 'i', 'n', 'a', '\0'};
D: char str[ ] = {"china"};
举一反三
- 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’};
- 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’};
- 下面的定义语句中,使数组str不能正确保存字符串的是()。 A: char str[6]="China"; B: char str[ ]="China"; C: char str[5]={'C','h','i','n','a'}; D: char str[6]={"China"};
- 下面()中,数组str保存的不是字符串。 A: char str[5]={'H','e','l','l','o'}; B: char str[6] = {"China"}; C: char str[6] = "China"; D: char str[ ] = "China";
- 下列能将字符串赋值给字符指针变量的是【】。 A: char *str="China" B: char str="China" C: char *str=China D: char str=China