Created
June 11, 2013 11:05
-
-
Save ustbgaofan/5756071 to your computer and use it in GitHub Desktop.
strcpy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char * strcpy(char *str1,const char *str2) | |
{ | |
assert( (str1!=NULL)&& (str2 != NULL));//判断指针的合法性 | |
char *address = str1;//记录目标指针所指向的地址 | |
while( (*str1++=*str2++) !='\0');//拷贝知道str2结束 | |
return address;//返回目标地址 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment