xby@BI01:~/debug/sy> gcc -o tth tth.c -lpthread tth.c: In function 'main': tth.c:21: warning: incompatible implicit declaration of built-in function 'exit' xby@BI01:~/debug/sy> ./tth this is main h ho how how how y how yo how you how you how you d how you do how you doi how you doin how you doing xby@BI01:~/debug/sy> cat tth.c #include <pthread.h> #include <stdio.h> #include <unistd.h> char str[64] = {0}; char tmp[64] = "how you doing"; void thread() { int i = 0; for (i = 0; i < 13; i++) {str = tmp;sleep(1);} } int main() {pthread_t id; int i, ret; ret = pthread_create(&id, NULL, (void *)thread, NULL); if (ret != 0) {printf("error"); exit(1);} printf("this is main/n"); for(i = 0; i < 13; i++) {sleep(1);printf("%s/n", str);} pthread_join(id, NULL); return 0; }