#include<stdio.h>1#include<pthread.h>2#include<stdlib.h>3#include<string.h>4#include<unistd.h>56void* thread_function(void)7{8char *a = malloc(12);9strcpy(a, "hello world");10//sleep(10);11pthread_exit((void*)a);12}1314int main()15{16pthread_t thread_id;17char *b = NULL;18pthread_create (&thread_id, NULL, (void*)&thread_function, NULL);1920//21//While the created thread is running, the main thread can perform other tasks.2223//here we are reciving one pointer value so to use that we need double pointer24pthread_join(thread_id,(void**)&b);2526printf("b is %s\n", b);27free(b); // lets free the memory28}293031