#include <stdio.h>
#include <stdlib.h>
/*
用指针方式实现strcat.strcat(s,t)将t指向的字符串复制到s指向的字符串尾部
*/
int strcat(char *s,char *t)
{
if( s==NULL)return -1;
while(*s!='/0')
s++;
while( *s++=*t++)
;
return 0;
}
int main(void)
{
char a[1000]={"hello"};
char *b="world";
if( strcat(a,b) !=0)
return -1;
printf("a is :%s",a);
system("pause");
return 0;
}
#include <stdlib.h>
/*
用指针方式实现strcat.strcat(s,t)将t指向的字符串复制到s指向的字符串尾部
*/
int strcat(char *s,char *t)
{
if( s==NULL)return -1;
while(*s!='/0')
s++;
while( *s++=*t++)
;
return 0;
}
int main(void)
{
char a[1000]={"hello"};
char *b="world";
if( strcat(a,b) !=0)
return -1;
printf("a is :%s",a);
system("pause");
return 0;
}