Main process should wait for thread to end
add
pthread_join(thr,NULL);
after thread.
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
void *thrFoo(void *arg){
int x = *((int *)arg) ;
printf("res : %d\n",x*5 );
}
int main()
{
pthread_t thr;
int a = 4 ;
pthread_create(&thr,NULL,thrFoo,&a);
pthread_join(thr,NULL);
printf("I am trying to understand the logic of\n");
printf("Threads\n");
return 0;
}