以下程序 #include<stdio.h> #include<string.h> main() { char*pl="abc",*p2="ABC",str[50]="xyz"; strcpy(str+2.strcat(p1,p2)); printf("%s ,str); } 的输出是______。
- AxyzabcABC
- BzabcABC
- CyzabcABC
- DxyabcABC
以下程序 #include<stdio.h> #include<string.h> main() { char*pl="abc",*p2="ABC",str[50]="xyz"; strcpy(str+2.strcat(p1,p2)); printf("%s ,str); } 的输出是______。
解析: strcat(p1,P2)将字符串abcABC放到了*pl所指向的存储单元中;strcpy在本题将abcABC复制到str+2所指向的存储单元中,即覆盖原str数组中的字符z及其后的所有字符,故str的值为“xyabcABC”。