What is the output of the following program? main() { int a = 10; if ((fork()…

ISRO Scientist/Engineer SC 2017

What is the output of the following program?

main()
{
    int a = 10;
    if ((fork() == 0))
        a++;
    printf("%d\n", a);
}
  1. A.

    10 and 11

  2. B.

    10

  3. C.

    11

  4. D.

    11 and 11

Attempted by 664 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…