以下错误的字符数组的赋值方式是【 】。
A: char string[]="I am a student.";
B: char *p="I am a student";
C: char str[20]; str="I am a student.";
D: char str[20];strcpy( str,"I am a student.") ;
A: char string[]="I am a student.";
B: char *p="I am a student";
C: char str[20]; str="I am a student.";
D: char str[20];strcpy( str,"I am a student.") ;
举一反三
- 对于用字符数组和字符指针变量处理字符串,下列定义的语句,错误的是()。 A: char str[20]; str ="I am student”; B: char *str;str =“I am studen”; C: char str[20] =“I am studen”; D: char *str = {“I am studen”};
- 下列字符串赋值方式不正确的是( ) A: char str[20]; B: char *str ;str=”I am a boy!”; str=”I am a boy!”; C: char *str=”I am a boy!”; D: char str[20]=” I am a boy!”;
- 19.下列字符串赋值方式不正确的是 A: char str[20]; str=”I am a boy!”; B: char *str ; str=”I am a boy!”; C: char *str=”I am a boy!”; D: char str[20]=” I am a boy!”;
- 已知s1="I "am a student.",s2='I \'am a student',则print(s1,s2)的输出结果为( ) A: I 'am a student. I 'am a student B: I "am a student. I 'am a student C: I "am a student. I \'am a student D: 程序报错
- 下列字符串赋值方式不正确的是( ) A: A.char str[20]; str="I am a boy!"; B: B.char *str; str="I am a boy!"; C: C.char *str="I am a boy!"; D: D.char str[20]=" I am a boy!";