#include "stdio.h"#include "string.h"char *str(char d[],char s[]){ char *p=d;; while(*p!='\0')p++; do { *p++=*s++; }while(*s!='\0'); *p=0; return d;}int main(){char d[20],s[20];strcpy(d,"string ");strcpy(s,"cat");printf("%s\n",str(d,s));}
本文共 321 字,大约阅读时间需要 1 分钟。
#include "stdio.h"#include "string.h"char *str(char d[],char s[]){ char *p=d;; while(*p!='\0')p++; do { *p++=*s++; }while(*s!='\0'); *p=0; return d;}int main(){char d[20],s[20];strcpy(d,"string ");strcpy(s,"cat");printf("%s\n",str(d,s));}
转载于:https://www.cnblogs.com/tinaluo/p/5297177.html