Question: You are required to trace the following program where the input provided to the scanf is your student number. You must draw the process tree,
You are required to trace the following program where the input provided to the scanf is your student number. You must draw the process tree, identify a potential output and clearly state if the output could be different. int num; scanf("%d", &num); int n1; int pid = -1; for(int i=0; i<2; i++) { if(pid) { n1 = num%10; pid = fork(); num /= 10; } } for(int i=0; i<3; i++) { if(i == 0 && n1%2) { if(!fork()) { printf("X"); return 0; } } printf("%d", num); num /= 10; }
Step by Step Solution
3.41 Rating (148 Votes )
There are 3 Steps involved in it
Here is the flow of the program int num s... View full answer
Get step-by-step solutions from verified subject matter experts
