{
while(*(s++));
s--;
while(*ct)
*(s++) = *(ct++);
return s;
}數組實現:#include<stdio.h>void mystrcat(char s[],char ct[]) //字符串連接
{
int i;
int length1 = 0,length2 = 0;
while(s[length1++]);
while(ct[length2++]);
length1--;
for(i = length1;i < length1+length2;i++)
s[i] = ct[i-length1];
}int main()
{
char s[100] = "123456";
char ct[] = "dfhjk";
mystrcat(s,ct);
printf("%s\n",s);
return 0;
}