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