用指针实现字符串函数strcat()的功能.

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
 char s1[1024], s2[1024];
 char*p, *q;
 gets(s1);
 gets(s2);
 p = s1;
 q = s2;
 while (*p){
  p++;
 }
 while (*q){
  *p++ = *q++;
 }
 *p = '\0';
 puts(s1);
 system("pause");
 return 0;
}
发布了42 篇原创文章 · 获赞 13 · 访问量 6536

猜你喜欢

转载自blog.csdn.net/weixin_43508555/article/details/84036946