柠檬试题库
search
首页
计算机
公务员
驾照
关于
share
有以下程序 #include
#include
main() { char w[20], a[5][10]={"abcdef", "ghijkl", "mnopq", "rstuv", "wxyz."}; int i; for (i=0; i<5; i++) w[i]=a[i][ strlen(a[i]) - 1]; w[5]= '\0'; puts(w); } 程序的运行结果是
A.flqv.
B.agmrw
C.ekpuy
D.flqvz
热度🔥2,125
参考答案:A
解析:
【解析】puts()函数将数组中存放的字符串输出到输出设备中,用“\n”取代字符串结束符“\0”。strlen()函数是求字符串的实际长度(不包含结束标志),并且作为函数值返回。程序中for循环实现,将第i个字符串最后一个字符放入w数组下标值为i的位置,即a[i][5]。最后将数组最后一个字符赋值为“\0”,输出字符串w为flqv,A选项正确。
复制题目向AI提问
content_copy
content_copy
扫码免费计算机二级刷题
2025年计算机等级考试题库
推荐
窗体主体的 BackColor 属性用于设置窗体主体的是( )。
有以下程序: # include main() { unsigned char a=8, c; c = a>>3; printf("%d\n", c); } 程序运行后的输出结果是( )。
如果在一台主机的Windows环境下执行Ping命令得到下列信息: Pinging www.nankai.edu.cn [202.113.16.33] with 32 bytes of data: Reply from 202.113.16.33: bytes=32 time<1ms TTL=128 Reply from 202.113.16.33: bytes=32 time<1ms TTL=128 Reply from 202.113.16.33: bytes=32 time<1ms TTL=128 Reply from 202.113.16.33: bytes=32 time<1ms TTL=128 Ping statistics for 202.113.16.33: Packets: Sent = 4, Received = 4, Lost = 0(0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms 那么下列结论中无法确定的是()。
若将一幅图片以不同的文件格式保存,占用空间最大的图形文件格式是( )。
标签
二级C语言
字符串
程序
最后
数组