A: 8
B: 9
C: 10
D: 11
举一反三
- 若有定义char str[]= “very good”, 则str的长度为( )
- 若有定义char str[]="c program", 则数组str的长度为( )
- 若有如下定义:char str[]="China";则数组str的长度为
- ( )不能对字符串赋初值.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'};
- 若有定义char str[3][6],则数组str有( )元素。 A: 10 B: 12 C: 18
内容
- 0
以下不能正确进行字符串赋初值的语句是( )。 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!";
- 1
( )不能对字符串赋初值.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'};
- 2
若有数组定义char str[ ]="hello";则数组str所占空间为______个字节。
- 3
若有数组定义:char str[]=”hello”;则数组str所占的空间为( )个字节。 A: 5 B: 6 C: 7 D: 8
- 4
若有定义char str[]=”china”;则该字符串的长度是( ),字符数组str所占的存储空间字节数是( )。 A: 5 B: 6 C: 7 D: 8