/*
* strcat 连接字符串
*/
#include <cstdio>
char * strcat ( char * destination, const char * source ) {
char *p = (char *)source;
while (*destination++ != '\0')
;
--destination;
while (*destination++=*p++)
;
return p-1;
}
int main ()
{
char str[80] = {0};
strcat (str,"these ");
strcat (str,"strings ");
strcat (str,"are ");
strcat (str,"concatenated.");
puts (str);
return 0;
}
C 标准库 strcat 函数的实现
最新推荐文章于 2023-10-13 17:44:34 发布