I am getting 6 calls to red and 8 calls to green when i built parent child tree but when i ran this code
http://ideone.com/UBaBB I got 10 calls to red and 10 calls to green. Can some explain this ? On Aug 22, 9:31 pm, ghsjgl k <[email protected]> wrote: > i saw this question in one of DREAM companies > > i dont know the answer > > > > > > > > On Mon, Aug 22, 2011 at 11:43 AM, dexter does <[email protected]> wrote: > > void red() > > { > > > } > > void green() > > { > > > } > > main() > > { > > fork(); > > int color=fork(); > > if(color==0) > > fork(); > > red(); > > if(color==0) > > fork(); > > green(); > > getch(); > > > } > > > How many times red and green are called and pls give an explanation for > > your answer > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
