与如下代码不等价的语句是( )
char str[ ] = "CProgram";
A: char str[9] =
“CProgram”;
B: char str[ ] = {'C',
'P', 'r', 'o', 'g', ‘r’, ‘a’, ‘m’,
‘\0’};
C: char str[ ] = {'C',
'P', 'r', 'o', 'g', ‘r’, ‘a’, ‘m’};
D: char str[ ] = {"
CProgram "};
char str[ ] = "CProgram";
A: char str[9] =
“CProgram”;
B: char str[ ] = {'C',
'P', 'r', 'o', 'g', ‘r’, ‘a’, ‘m’,
‘\0’};
C: char str[ ] = {'C',
'P', 'r', 'o', 'g', ‘r’, ‘a’, ‘m’};
D: char str[ ] = {"
CProgram "};
举一反三
- 以下不能正确进行字符串初始化的语句是( ) 。 A: char<br/>str[]={"gosh!"}; B: char<br/>*str="gosh!"; C: char<br/>str[5]="gosh!"; D: char<br/>str[6]={ 'g', 'o', 's', h',’!’,’\0’};
- 要使字符数组str存放一个字符串"progress",正确的定义语句是( )。 A: char str[8]={'p','r','o','g','r','e','s','s'}; B: char str[8]="progress"; C: char str[]={'p','r','o','g','r','e','s','s'}; D: char str[]="progress";
- ( )不能对字符串赋初值.A) char str[5]="good!"; B) char str[]="good!";C) char *str="good!"; D) char str[ ]={‘g',‘o',‘o',‘d',‘!',‘\0'}; A: char str[5]="good!"; B: char str[]="good!"; C: char *str="good!"; D: char str[ ]={‘g',‘o',‘o',‘d',‘!',‘\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="good!"; C、char str[]="good!"; D、char str[5]={'g', 'o','o', 'd'}; A: char *str="good!"; B: char str[5]={'g', 'o','o', 'd'}; C: char str[]="good!"; D: char str[5]= "good!";