#include#include #include #include char*my_strcat(char*dest, const char*src){assert(dest!=NULL);assert(src);char*ret = dest;while (*dest){dest++;}while (*dest++ = *src++){;}return ret;}int main(){char *p = "bit";char arr[20] = "hello";printf("%s\n", my_strcat(arr, p));system("pause");return 0;}
结果:
hellobit