字符串拼接函数
//strcat l(char t .chars[])
//把数组s里存储的字符串拼接到字符数组t存储的字符串后面/s:hello t:ok拼接后t里面存储的字符串是okhello
#include<stdio.h>
void strcat_1(char t[],char s[])
{
int i,j;
i=0;
while(t[i]!='\0'){
i++;
j=0;
}
while(s[j]!='\0'){
t[i+j]=s[j];
j++;
}
}
void main()
{
char t[100]="ok";
char s[100]="hello";
strcat_1(t,s);
puts(t);
}
在dev-c++里面,只报了一个main函数必须为int类型的错误,运行结果也没出现错误。
没有错误啊,你运行报什么错了