A: char str[] = "hello";
B: char str[100] = "hello";
C: char str[] = {'h','e','l','l','o'};
D: char str[] = { 'hello' }
举一反三
- 下面错误的初始化语句是_____ A: char str[]="hello"; B: char str[]={'hello'}; C: char str[100]="hello"; D: char str[]={'h','e','l','l','o'};
- 以下正确的初始化语句是: A: char str[]="HELLO"; B: char str[100]= "HELLO"; C: char str[] = {'H', 'E', 'L', 'L', 'O'}; D: char str[] = {'HELLO'}
- 下列初始化字符数组的语句,正确的是( )。 A: char[100] str = ""; B: char[5] str = {"hi"}; C: char[5] str = "hello"; D: char[] str = {'h', 'e', 'l', 'l', 'o'};
- 下列初始化字符数组的语句中,正确的是( )。 A: char str[5] = "hello"; B: char[] str = {'h', 'e', 'l', 'l', 'o'}; C: char str[5] = {"hi"}; D: char str[100] = "";
- 以下对字符数组str初始化不等价的是( )。 A: char str[ ]="hello"; B: char str[ ]={'h','e','l','l','o','\0'}; C: char str[ ]={'h','e','l','l','o',0}; D: char str[ ]={'h','e','l','l','o'};
内容
- 0
下面哪个选项不能将"hello"字符串存入字符数组str中( )。 A: char str[]="hello" ; B: char str[30]; strcpy(str, "hello"); C: char str[30];str="hello"; D: char str[30],*ps=str; strcpy(ps,"hello");
- 1
下列关于字符串使用正确的是() A: char str[10]; str="Hello"; B: char *str; strcpy(str,"Hello"); C: char *str1,str[10]="Hello"; strcpy(str,str1); D: char *str; str="Hello";
- 2
Java语言中,正确的初始化语句是()。 A: charstr[]="hello"; B: char str[]={'h','e','l','l','o'}; C: charstr[100]="hello"; D: charstr[]={'hello'};
- 3
如何将字符串“Hello World”写入a.txt文件内?FILE *file; file = fopen("a.txt","w"); A: char str = "Hello World"; fputs(&str,file); B: char str = "Hello World"; fputc(&str,file); C: char str = "Hello World"; fput(&str,file); D: char str = "Hello World"; fputs(str,file);
- 4
下面()中,数组str保存的不是字符串。 A: char str[5]={'H','e','l','l','o'}; B: char str[6] = {"China"}; C: char str[6] = "China"; D: char str[ ] = "China";