执行如下代码段输出结果为char s1[10]="nanjing",s2[]="hello";strcpy(s1,s2);puts(s1);
A: hello
B: hellog
C: hello\0g
D: hellog
A: hello
B: hellog
C: hello\0g
D: hellog
举一反三
- char s1[ ] = "hello ";char s2[ ] = "tangx ";strcpy(s1, s2);printf("%s\n", s1);以上代码段执行结果为哪个选项? A: hello tangx B: tangx hello C: hello D: tangx
- 执行下列程序段的输出结果为。 char s1[20]="Love",s2[]="China"; s1=s2; puts(s1);
- char s[80],*sp="HELLO!";sp=strcpy(s,sp);s[0]='h';puts(sp);运行结果:________
- 下列语句执行完,输出的结果为 。char a[5][10]={"student","worker","soldier","cadre","peasant"};char s1[10], s2[10];strcpy(s1,a[0]); strcpy(s2,a[0]);for(int i=1;i[5;i++) { if(strcmp(a[i], s1)]0) strcpy(s1,a[i]); if(strcmp(a[i], s2)<0) strcpy(s2,a[i]);}cout<<s1<<’ ’<<s2<<endl;[/i][/i][/i][/i]
- 以下程序段的输出结果是 。Char s[ ]=”Hello World!”;Strlwr(s);Printf(“%s”,s); A: hello world! B: HELLO world! C: hello WORLD! D: HELLO WORLD!