#include #include void *ChildThread(void *N) { int i; int fact = 1; for(i=1;i<=(int)N;++i) { fact*=i; } pthread_exit((void *)fact); // Notice the cast } int main(void) { int N = 8; pthread_t hThread; void * fact; pthread_create(&hThread,NULL, ChildThread,(void *)N); pthread_join(hThread, &fact); printf("Factorial of N = %d\n",(int)fact); return 0; }