字符串连接

字符串连接

/* 功能:字符串连接 日期:2013-05-26 */ #include<stdio.h> #include<stdlib.h> #include<math.h> int main(void) { char str1[]=“hello”; char str2[]=” world!”; char str3[20]={0}; int i,tmp,j; for(i=0;i<5;i++) { str3[i]=str1[i]; } tmp=i; for(i=tmp,j=0;j<7;i++,j++) { str3[i]=str2[j]; } printf(“str3=”); for(i=0;i<20;i++) { printf(“%c”,str3[i]); } printf(“n”); system(“pause”); return 0; }

本文采用 CC BY-NC-SA 4.0 许可,转载请注明出处与作者。

支持一下

如果这篇文章对你有帮助,欢迎打赏或分享。

打赏支持

评论