Answers

Question and Answer:

  Home  Linux Debugging

⟩ What is the output of this program no 1? #include<stdio.h> #include<pthread.h> void *fun_t(void *arg); void *fun_t(void *arg) { printf("googlen"); pthread_exit("Bye"); } int main() { pthread_t pt; void *res_t; if(pthread_create(&pt,NULL,fun_t,NULL) != 0) perror("pthread_create"); return 0; } a) this program will print the string "google" b) this program will print nothing c) segmentation fault d) run time error

b) this program will print nothing

Explanation:The pthread_join() function waits for the thread to terminate.

Output:

[root@localhost google]# gcc -o san san.c -lpthread

[root@localhost google]# ./san

[root@localhost google]#

 151 views

More Questions for you: