1. 程式人生 > >用指標實現字串函式strcat()的功能.

用指標實現字串函式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;
}