프로그래밍 연습-strcpy 혼자 쓰기.
2319 단어 RCP
char *strcpy_(char *strDest, const char *strSrc)
{
// Error
if(strSrc == NULL)
return NULL;
const char* p = strSrc;//const ?* , , !
char* q = strDest;
p = strSrc;
q = strDest;
while(*p != '\0')
*q++ = *p++;
*q = '\0';
return strDest;
}
// , !
char * __cdecl strcpy__(char * dst, const char * src) {
char * cp = dst;
while( *cp++ = *src++ ) ; /* Copy src over dst */
return( dst );
}