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 / sourisengupta

finally we will get 001111.

for the first fork() two 0 will be printed and for secoond
forkk four 1 will be printed.

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is realloc in c?

571


Does c have enums?

588


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

1832


What is non linear data structure in c?

559


What are header files and explain what are its uses in c programming?

593






How to explain the final year project as a fresher please answer with sample project

459


in iso what are the common technological language?

1616


Why calloc is better than malloc?

561


what are bit fields in c?

592


I heard that you have to include stdio.h before calling printf. Why?

576


Explain what does the function toupper() do?

621


Explain what is the advantage of a random access file?

648


Explain what is wrong in this statement?

620


What is the use of getchar() function?

617


Why c language is called c?

557