#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<assert.h>
char* my_strcat(char* str1, const char* str2)
{
char* ret = str1;
assert(str1 && str2);
while (*str1 != '\0')
{
str1++;
}
while (*str1++ = *str2++)
;
return ret;
}
int main()
{
char arr1[40] = "abcde";
char arr2[] = "jwdddd";
my_strcat(arr1, arr2);
printf("%s\n", arr1);
return 0;
}
my_strcat模拟实现
于 2024-04-19 10:54:03 首次发布