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

Disadvantages of C language.

663


Can we replace the struct function in tree syntax with a union?

783


What do you mean by dynamic memory allocation in c? What functions are used?

658


Why is structure important for a child?

604


How do you list a file’s date and time?

636






Is main an identifier in c?

605


What is fflush() function?

645


What is the use of typedef in c?

588


What are identifiers c?

567


What are examples of structures?

598


What are header files in c programming?

658


How can you tell whether a program was compiled using c versus c++?

620


i want to know the procedure of qualcomm for getting a job through offcampus

1940


Explain how can I convert a number to a string?

650


When should structures be passed by values or by references?

586