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 the difference between struct and typedef struct in c?

47


How do you construct an increment statement or decrement statement in C?

90


Can a variable be both const and volatile?

75


Is c is a high level language?

43


Which is best book for data structures in c?

44






What is operator precedence?

72


How can I split up a string into whitespace-separated fields?

56


Explain which function in c can be used to append a string to another string?

64


What is a keyword?

96


What is the meaning of typedef struct in c?

38


#include int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

503


praagnovation

1061


int far *near * p; means

2468


What is the return type of sizeof?

41


Place the #include statement must be written in the program?

58