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!";
内容
- 0
下列程序片段中不正确的字符串赋值或初始化方式是( )。 A: char str[10]; str=”string”; B: char *str; str=”string”; C: char str[7]={’s’,’t’,’r’,’i’,’n’,’g’,’0’}; D: char str[ ]=”string”;
- 1
在以下字符串String的赋值运算中,错误的是( )。? char str[]= { 'S' ,'t', 'r' ,'i','n', 'g',0};|char str[10]= { 'S' ,'t', 'r' ,'i','n', 'g','\0'};|char str[6]= { 'S' ,'t', 'r' ,'i','n', 'g'};|char str[10]= "String";
- 2
以下给字符数组str定义和赋值正确的是( )。 A: char str[10]; str={"China!"}; B: char str[ ]={"China!"}; C: char str[10]; strcpy( str,"abcdefghijkl"); D: char str[10]={"abcdefghijkl"};
- 3
不正确的字符串赋值或初始化方式是________。 A: char *str; str = "string"; B: char str[7] = {'s', 't', 'r', 'i', 'n', 'g'}; C: char strl[l0]; strl = "string"; D: char strl[ ] = "string", str2[ ] = "12345678"; strcpy (str2, strl);
- 4
【单选题】如果输出语句:printf(“I am “student" you is teacher "). 显示内容? A. I am “student" you is teacher B. I am student you is teacher C. I am student you is teacher D. I am “student" you is teacher