Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the difference between single charater constant and string constant?

1031


What is a list in c?

983


Is main an identifier in c?

1087


What is 2 d array in c?

959


What is the importance of c in your views?

1094


What are the functions to open and close file in c language?

1131


What is the difference between struct and typedef struct in c?

1083


Describe static function with its usage?

1152


When the macros gets expanded?

1339


What are local static variables? How can you use them?

1081


hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..

1869


What is register variable in c language?

987


How do I use strcmp?

1024


How do c compilers work?

1049


in iso what are the common technological language?

2048