When I run the following program, the output is 5.
Why 5? Why not 8?
void *doit(void *vargp) {
int i = 3;
int *ptr = (int*)vargp;
(*ptr)++;
}
int main() {
int i = 0;
pthread_t tid;
pthread_create(&tid, NULL, doit, (void*)&i);
pthread_join(tid,NULL);
i = i + 4;
printf("%d",i);
}