#include <stdio.h> #include <string.h> int main() { char str[] = "there are plenty of good reasons "; char str0[] = "for a young person to choose to go to university."; printf("%s ", strcat(str, str0)); char str1[] = "Work is like a capricious lover "; char str2[] = "whose incessant demands are resented"; char str3[] = " but who is missed terribly when she is not there."; //有了上面的例子,我们可以把三个或者更多的string给连接起来 printf("%s ", strcat(strcat(str1, str2), str3)); return 0; }
输出结果为:
there are plenty of good reasons for a young person to choose to go to university. Work is like a capricious lover whose incessant demands are resented but who is missed terribly when she is not there.