char *p1=“abcd”,*p2=“ABCD”,str[50]=“xyz”;strcpy(str+2,strcat(p1+2,p2+1));printf(“%s”,str);请问输出结果?

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 11:26:34

char *p1=“abcd”,*p2=“ABCD”,str[50]=“xyz”;strcpy(str+2,strcat(p1+2,p2+1));printf(“%s”,str);请问输出结果?
char *p1=“abcd”,*p2=“ABCD”,str[50]=“xyz”;
strcpy(str+2,strcat(p1+2,p2+1));
printf(“%s”,str);
请问输出结果?

char *p1=“abcd”,*p2=“ABCD”,str[50]=“xyz”;strcpy(str+2,strcat(p1+2,p2+1));printf(“%s”,str);请问输出结果?
1 程序不仅有语法错误,而且有严重的逻辑错误,不能运行.
strcat(p1+2,p2+1); //p1是指针常值,所指对象不能修改的.
2 程序改为下面,才能运行.
#include
#include
void main()
{
\x09char p1[50]="abcd",p2[50]="ABCD",str[50]="xyz";
\x09strcpy(str+2,strcat(p1+2,p2+1));
\x09printf("%s",str);
}
//运行结果是:
xycdBCD