日期:2014-05-16 浏览次数:20838 次
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
/*返回字符串常量的地址*/
void* task1(void* p){
char* str = "Hello World";
return str;
}
int main()
{
pthread_t tid;
pthread_create(&tid, 0, task1, 0);
char* str;
pthread_join(tid, (void**)&str);
printf("str=%s\n", str); //return的str保存在str里???
}