Thread Arg Sum
Thread Arg Sum
#include<stdio.h>
#include<unistd.h>
#include<pthread.h>
void *thread_function(void *arg);
int num[2]={3,5};
int main()
{
pthread_t a_thread; // thread declaration
void *result;//going to store the return by the function
pthread_create(&a_thread,NULL,thread_function,(void *)num); //thread created
pthread_join(a_thread,&result); //PROCESS WAITS FOR THREAD TO FINISH.COMMENT THIS
LINE TO SEE THE DIFFERENCE.IT IS RETURNING NOTHING TO MAIN HERE SO NULL.
printf("inside main process\n");
printf("threads returns : %s\n",(char *)result);
}