What is output of the following program?
int main()
{
fork();
fork();
fork();
if (wait(0) == -1)
printf("leaf child\n");
}
int main()
{
fork();
fork();
fork();
if (wait(0) == -1)
printf("leaf child\n");
}
A. "leaf child" will be printed 1 times
B. "leaf child" will be printed 3 times
C. "leaf child" will be printed 4 times
D. "leaf child" will be printed 8 times
Answer: Option C
Join The Discussion