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 / srikanth
print order cannot be predicted.Total 8 process(including
main) first process prints 0,1
the first child prints 0,1 and the other 2 child/grand child
process print 1's (two 1s). The other four child/grand child
process wont print anything (created after printf)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are multibyte characters?
What is variable and explain rules to declare variable in c?
Is that possible to add pointers to each other?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is the advantage of an array over individual variables?
What is ctrl c called?
Explain what does the format %10.2 mean when included in a printf statement?
What are pointers in C? Give an example where to illustrate their significance.
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What is the difference between constant pointer and constant variable?
please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com
Did c have any year 2000 problems?
What is the difference between functions getch() and getche()?
Wt are the Buses in C Language