/* 功能:字符串连接 日期: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; }