以下不能正确进行字符串初始化的语句是( ) 。
A: char
str[]={"gosh!"};
B: char
*str="gosh!";
C: char
str[5]="gosh!";
D: char
str[6]={ 'g', 'o', 's', h',’!’,’\0’};
A: char
str[]={"gosh!"};
B: char
*str="gosh!";
C: char
str[5]="gosh!";
D: char
str[6]={ 'g', 'o', 's', h',’!’,’\0’};
举一反三
- 以下能正确定义字符串的语句是_____。 A: char<br/>str="\x43"; B: char str[]="\0"; C: char str=‘’; D: char<br/>str[]={'\064’};
- 以下不能正确进行字符串初始化的语句是: A: char str[5] = "good!"; B: char str[5] = {'g', 'o', 'o', 'd', '!'}; C: char str[] = {'g', 'o', 'o', 'd', '!'}; D: char str[] = "good!"; E: char str[8] = "good!"; F: char *str = "good!"; G: char str[8] = {'g', 'o', 'o', 'd', '!'};
- 与如下代码不等价的语句是( ) <br/>char str[ ] = "CProgram"; A: char str[9] =<br/>“CProgram”; B: char str[ ] = {'C',<br/>'P', 'r', 'o', 'g', ‘r’, ‘a’, ‘m’,<br/>‘\0’}; C: char str[ ] = {'C',<br/>'P', 'r', 'o', 'g', ‘r’, ‘a’, ‘m’}; D: char str[ ] = {"<br/>CProgram "};
- 以下不能正确进行字符串赋值初值的语句是( )。 A: char str[5]="good!"; B: char str[]="good!"; C: char *str="good!"; D: char str[5]={'g','o','o','d');
- 下列不能正确进行字符串初始化的是( )。 A: char str[8] = {'g', 'o', 'o', 'd', '!','\0'}; B: char str[8] = "good!"; C: char *str = "good!"; D: char str[] = {'g', 'o', 'o', 'd', '!'};