Question 51
What is the output of the following program?
main( )
{
int a = 10;
if ((fork ( ) == 0))
a++;
printf (“%d
”, a );
}Step-by-Step Solution
Detailed Explanation:
Child process (fork()==0) increments a to 11 and prints 11.
Parent process prints original $a=10$. Output prints 10 and 11.