标签:
#include <stdio.h>
#define MAX 100
/*
用指针的方式 实现 函数strcat(s,t);
将t指向的字符串复制到s指向的字符串尾部
*/
int main()
{
char s[] = "hello,";
char t[] = "world!";
char k[MAX];
void sscopy(char *,char *);
void sstrcat(char *,char *);
sscopy(k,s);
sstrcat(k,t);
printf("%s\n",k);
return 0;
}
void sstrcat(char *k,char *t)
{
while(*k != ‘\0‘){
k++;
}
while(*t != ‘\0‘){
*k++=*t++;
}
*k = ‘\0‘;
}
void sscopy(char *k,char *s)
{
while(*s)
*k++ = *s++;
*k = ‘\0‘;
}
标签:
原文地址:http://www.cnblogs.com/cloudddl/p/4828532.html