char *p="abcdefgh";p+=3;printf("%d\n",strlen(strcpy(p,"ABCD")))
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 23:12:14
char*p="abcdefgh";p+=3;printf("%d\n",strlen(strcpy(p,"ABCD")))char*p="abcdefgh";p+=3;printf("%d\n",s
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 *p="abcdefgh";p+=3;printf("%d\n",strlen(strcpy(p,"ABCD")))
你这是错误代码.错在char *p="abcdefgh";这样定义的字符串是常字符串,不能进行写操作,所以strcpy(p,"ABCD")是非法语句,会出现运行时错误.这样改正:char a[]=
"abcdefgh",*p=a;p+=3;printf("%d\n",strlen(strcpy(p,"ABCD")));就可以了.结果应该是4,就是拷贝进去的ABCD的长度.没有试,你试试……