strcat函数实现

来源:互联网 发布:淘宝怎么看在线人数 编辑:程序博客网 时间:2024/06/05 16:22
#include<stdio.h>char * my_strcat(char *strDest, const char *strSrc);int main(void){char d[20] = "hello";char *s = ",world";char *p = my_strcat(d, s);printf("The string is:%s\n", p);return 0;}char * my_strcat(char *strDest, const char *strSrc){if(NULL == strDest || NULL == strSrc )return strDest;char *str_tmp = strDest;while(*strDest)strDest++;while(*strDest++ = *strSrc++);return str_tmp;}

0 0