注册 登录
编程论坛 C++教室

求指教,谢谢!

张影 发布于 2014-12-27 10:51, 550 次点击
#include"string.h"

main( )

{ char *p1,*p2,str[50]="ABCDEFG";
p1="abcd"; p2="efgh";
strcpy(str+1,p2+1);
strcpy(str+3,p1+3);
printf("%s",str);
}
这道题怎么算的?看不懂
2 回复
#2
peach54602014-12-27 15:42
原型声明:extern char *strcpy(char* dest, const char *src);
头文件:#include <string.h> 和 #include <stdio.h>
功能:把从src地址开始且含有NULL结束符的字符串复制到以dest开始的地址空间
说明:src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。
返回指向dest的指针。
#3
张影2014-12-27 16:15
回复 2楼 peach5460
非常感谢!!
1