字串的 串接
(高顯忠, sjgau4311@gmail.com, 2011-04-28 14:54)
1樓
#if 0
#endif
// ------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char s1[80], s2[80], s3[80];
int i;
strcpy(s1, "apple");
strcpy(s2, "orange");
strcpy(s3, s1);
strcat(s3, ", ");
strcat(s3, s2);
printf("s3= [%s] \n", s3);
system("pause");
for (i=0;s3[i] != '\0';i++) {
printf("%3d, %3d, %2c \n", i, s3[i], s3[i]);
}
printf("\n *** %d, %d, %c \n", i, s3[i], s3[i]);
system("pause");
return 0;
}
// ------------------------------------------------------------------