请求解答c语言题目

来源:百度知道 编辑:UC知道 时间:2024/06/05 22:08:04
写出下列程序的运行结果
main( )
{ static char s1[20]=“My ”,s2[20]=“book!”,s3[]=“Your ”;
strcpy(s2,“car!”);strcpy(s1,s3);
strcat(s1,s2);printf(“%s”,s1);
}
运行结果:
难道不需要过程么

Yourcar!

#include<stdio.h>
#include<string.h>
void main( )
{ static char s1[20]="My",s2[20]="book!",s3[]="Your";
strcpy(s2,"car!");strcpy(s1,s3);
strcat(s1,s2);printf("%s",s1);
}
经过vc++运行后的结果是:Yourcar!
这段代码可以直接复制就可以成功运行

运行结果为:Yourcar!
需要什么过程啊,那就是个函数,总店是你头文件里要包含#include<string.h>就可以了

your car!