下面哪个选项不能将"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");
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");
举一反三
- 下列关于字符串使用正确的是() 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";
- 如何将字符串“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);
- 1、下面正确的数组初始化语句是()。 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'};
- 若有定义char str[8]; ,以下正确的语句是()。 A: str[8]= "Hello C"; B: str="Hello C"; C: str[]="Hello C"; D: strcpy(str,"Hello C");