@ ravi but compile it on http://ideone.com/nkTVN it showing 45 hello plz do look at it.......
On Thu, Sep 22, 2011 at 12:59 AM, Rashmi Jain <[email protected]>wrote: > @ravi: thanks..!! > > > On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon <[email protected]>wrote: > >> ohh sorry, I thought it was i<=9. Yes only 9 times Hello will be printed. >> >> On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain >> <[email protected]>wrote: >> >>> @ravi >>> can u plz explain how 10 processes are created..? shouldn't it be 9..?? >>> >>> On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon <[email protected]>wrote: >>> >>>> Output Hello printed 10 times. Since form command spawns the process, so >>>> for every call their are two process created and since if process gets >>>> successfully created fork returns some positive no. which is the process >>>> id, >>>> so it will break the loop and finally only the 10 child processes will be >>>> left which will print Hello 10 times. I hope that I cleared your doubt. >>>> >>>> >>>> On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya <[email protected]>wrote: >>>> >>>>> http://ideone.com/nkTVN >>>>> >>>>> >>>>> On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar < >>>>> [email protected]> wrote: >>>>> >>>>>> "Hello" will be printed 45 times... >>>>>> >>>>>> >>>>>> On Wed, Sep 21, 2011 at 7:57 PM, sush57 <[email protected]>wrote: >>>>>> >>>>>>> main() >>>>>>> { >>>>>>> int tmp; >>>>>>> for(i=0;i<9;i++) >>>>>>> { >>>>>>> tmp=fork(); >>>>>>> if(tmp>0) >>>>>>> break; >>>>>>> printf("Hello"); >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> >>>>>>> what's the output and how does this work.... >>>>>>> >>>>>>> can u give few other questions using fork... >>>>>>> >>>>>>> -- >>>>>>> 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. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> *Anil Arya, >>>>> Computer Science * >>>>> *Motilal Nehru National Institute of Technology,Allahabad . >>>>> * >>>>> >>>>> >>>>> -- >>>>> 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. >>>>> >>>> >>>> >>>> >>>> -- >>>> Regards >>>> Ravi Maggon >>>> B.E. CSE, Final Year >>>> Thapar University >>>> >>>> www.algorithmguru.com >>>> >>>> "*Failure is the opportunity to begin again more intelligently"* >>>> >>>> -- >>>> 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. >>> >> >> >> >> -- >> Regards >> Ravi Maggon >> B.E. CSE, Final Year >> Thapar University >> >> www.algorithmguru.com >> >> "*Failure is the opportunity to begin again more intelligently"* >> >> -- >> 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. > -- 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.
