Question: What will be the final value of a as displayed by the final line of the program? int a = 0; int main() int

What will be the final value of "a" as displayed by the

final line of the program? int a = 0; int main() int  

What will be the final value of "a" as displayed by the final line of the program? int a = 0; int main() int pid1= fork(); a++; int pid2= fork(); a++; if (pidl == e |l pid2==0) { printf("Hello! "); } else ( printf("Goodbye! "); } att; printf("a is %d ", a);

Step by Step Solution

3.37 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

answer is a is always printed as 3 ie four times a is printed to be 3 output a is ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!