#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char* Strcat(char* str1, const char* str2) {
int n = strlen(str1);
int i = 0;
while (str1++[i + n] = str2++[i]);
return str1;
}
void main() {
char str1[256] = "abcd";
char str2[256] = "efgh";
printf("字符串1:%s\n", str1);
printf("字符串2:%s\n", str2);
Strcat(str1, str2);
printf("连接后字符串:%s\n", str1);
system("pause");
}
(C语言)写一个函数strcat,将两个字符串连接
最新推荐文章于 2024-09-02 20:29:23 发布