模拟实现stract函数

来源:互联网 发布:apache api中文手册 编辑:程序博客网 时间:2024/05/26 22:10
#include<stdio.h>#include<Windows.h>#include<assert.h>char *my_strcat(char *dst, const char *src){    assert(*dst !=NULL);    assert(*src !=NULL);    char *ret = dst;    while (*dst != '\0')    {        dst++;    }    while (*dst++ = *src++)    {        ;    }    return ret;}int main(){    char arr1[] = "hello";    char *arr2 = " world!";    printf("%s\n", my_strcat(arr1, arr2));    system("pause");    return 0;}
原创粉丝点击