Question: 3. The following code uses fork to create a new process. What will this program print when it runs? int pid fork(); if (pid

3. The following code uses fork to create a new process. What will this program print when it runs? int pid fork(); if (pid > 0) { printf("parent: child-%d ", pid); pid = wait ((int *) 0); printf("child %d is done ", pid); } else if (pid == 0) { printf("child: exiting "); exit (0); } else { printf("fork error "); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
