follow my heart...
分类: C/C++
2006-06-08 15:27:36
char a[50];
char b[50];
char c[50];
printf("First string: ");
gets(a);
printf("Second string: ");
gets(b);
while(a[i] != '\0') /* 将a串中内容copy到c中 */
{
c[i] = a[i];
i++;
}
while(b[j] != '\0') /* 将b串中内容继续copy到c中 */
{
c[i] = b[j];
i++;
j++;
}
c[i] = '\0'; /* 置串结束标志 */
printf("Connection : %s\n", c);
}
运行结果(VC):
===============================================
First string: abcdefg↙
Second string: hijklmn↙
Connection : abcdefghijklmn
===============================================