{ char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s\n",a);

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/11 23:58:06
{ char a[30]=

{ char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s\n",a);
{ char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s\n",a);

{ char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s\n",a);
#include
#include
void main()
{ char a[30]="nice to meet you!";
strcpy(a+strlen(a)/2,"you");
printf("%s\n",a);
}
输入出为:nice to you
strlen(a)/2=17/2=8 ,a+strlen(a)/2表示从a+8处【a代表数组首地址】开始复制,"nice to ”刚好6个字母和2个空格,然后复制you,输出nice to you