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 is the difference between single charater constant and string constant?
What is a list in c?
Is main an identifier in c?
What is 2 d array in c?
What is the importance of c in your views?
What are the functions to open and close file in c language?
What is the difference between struct and typedef struct in c?
Describe static function with its usage?
When the macros gets expanded?
What are local static variables? How can you use them?
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
What is register variable in c language?
How do I use strcmp?
How do c compilers work?
in iso what are the common technological language?