{ 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 youstrlen(a)/2=17/2=8 ,a+strlen(a)/2表示从a+8处【a代表数组...strlen(a)/2=17/2=8 当中的17是怎么得来的???应该是14吧。"nice to meet you!"这个字符串有14个字母和3个空格组成,长度为17,空格也计算在内的