Question: Choose the right answer please (operating system course) What is the correct output * 1 #include 2 #include 3 #include 4 5 void forkexample() 6.

 Choose the right answer please (operating system course) What is the

correct output * 1 #include 2 #include 3 #include 4 5 void

Choose the right answer please (operating system course)

What is the correct output * 1 #include 2 #include 3 #include 4 5 void forkexample() 6. { 7 int x = 1; 8 9 10 if (fork() = 0) printf("Child has x = = %d ", ++x); else printf("Parent has x = %d ", --x); 11 12 13 } 14 int main() 15 { 16 forkexample(); 17 return 0; 13 } 14 int main() 15 { 16 forkexample(); 17 return 0; 18 } Rintime error Child has x = 2 Parent has x = 0 Compilation error Parent has x = 0 Child has x = 2 Child has x = 2 Parent has x = 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!