单选题
C语言
题号 #1757880
#include void main()
{
char a[20], b[20], c[20];
scanf("%s%s", a, b);
gets(c);
printf("%s%s%s\n", a, b, c);
}
程序运行时从第一行开始输入 this is a cat!<回车>,则输出结果是( )。
thisisacat!
this is a
thisis a cat!
thisisa cat!
参考答案
C
答案解析
考察scanf和gets输入字符串的区别,scanf语句接收字符时遇到空格就作为一个字符串的结束,所以a数组中为this ,b数组中为is,但是getchar函数见到回车才认为结束所以c数组为 a cat!。所以打印结果如选项C。
你可能感兴趣的试题
A.xyz
B.wxyz
C.zyxw
D.zyx
A.****#????***#
B.***#????*****#
C.**#????*****#
D.****#????*****#