{ char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s\n",a);
人气:148 ℃ 时间:2020-06-05 18:03:11
解答
#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,空格也计算在内的
推荐
- void main(){char ch[30]="nice to meet you!';strcpy(a+strlen(a)/2,"you");printf("%s\n",a);}
- char *p="abcdefgh";p+=3;printf("%d\n",strlen(strcpy(p,"ABCD")))
- 下面程序段的运行结果是( ).char *p="abcdefgh"; p+=3; printf("%d\n",strlen(strcpy(p,"ABCD")
- char *s1="12345",*s2="1234"; printf("%d\n",strlen(strcpy(s1,s2)));
- 已知:char a[20]= "abc",b[20]= "defghi";则执行下列语句后printf("%d",strlen(strcpy(a,b)));
- 质子电子中子的体积
- 把月亮上的泥土全都运到地球上会怎么样呢?
- It has been many years since I was a big cheese.
猜你喜欢