What is the output of the following program

#include<stdio.h>
main()
{
int i=0;
fork();
printf("%d",i++);
fork();
printf("%d",i++);
fork();
wait();
}

Answer Posted / raghu

totally 8 processes...so each process will print 0 & 1
output: 0101010101010101

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is static identifier?

699


What is dangling pointer in c?

618


Write a code on reverse string and its complexity.

602


How does selection sort work in c?

617


What are qualifiers in c?

569






What is the use of clrscr?

589


What are the different types of constants?

637


What is array within structure?

578


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

2653


What are header files why are they important?

574


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

1576


Write programs for String Reversal & Palindrome check

594


Why isnt any of this standardized in c?

629


What is the best way to comment out a section of code that contains comments?

774


Multiply an Integer Number by 2 Without Using Multiplication Operator

314