#include#include char* strcpy(char *strDest,char *strSrc){ assert((strDest!=NULL)&&(strSrc!=NULL)); if(strDest==strSrc) return strDest; char *pDest=strDest; char *pSrc=strSrc; while(*pDest++=*pSrc++); *pDest='\0'; return strDest;}int main(){ char *p1="hello"; char p2[40]; strcpy(p2,p1); printf("%s",p2); return 0;}
至于为什么返回类型是char*,就是为了方便,链式表达式。