以下程序 #include<stdio.h> #include<string.h> main() { char*pl="abc",*p2="ABC",str[50]="xyz"; strcpy(str+2,strcat(

admin2010-05-22  17

问题 以下程序   #include<stdio.h>    #include<string.h>    main()    {  char*pl="abc",*p2="ABC",str[50]="xyz";       strcpy(str+2,strcat(p1,p2));       printf("%s\n",str);    }    的输出是________。

选项 A、xyzabcABC
B、zabcABC
C、yzabcABC
D、xyabcABC

答案8

解析 strcat(p1,p2)将字符串abcABC放到了*p1所指向的存储单元中;strcpy在本题将abcABC复制到str+2所指向的存储单元中,即覆盖原str数组中的字符z及其后的所有字符,故str的值为“xyabcABC”。
转载请注明原文地址:https://kaotiyun.com/show/EtWp777K
0

随机试题
最新回复(0)