http://ideone.com/l5ek4   .. in this it had shown 6

http://ideone.com/Lj56O  .. here 10 !!!!

On Sep 22, 8:27 am, siva viknesh <sivavikne...@gmail.com> wrote:
> somebody try to execute in linux and try to find the output...expected
> output is 9....but when first in ideone without \n in printf it showed
> 7 .. then with \n it showed 10... again with \n it showed 10 !!! ..
> whether its prob with compiler or fork's execution is differing i'm
> confused :(
>
> On Sep 22, 1:34 am, Rashmi Jain <rashmi.jain...@gmail.com> wrote:
>
>
>
>
>
>
>
> > but in this output 10  times hello is printed..how..??
>
> > On Thu, Sep 22, 2011 at 1:52 AM, ravi maggon <maggonr...@gmail.com> wrote:
> > > This is the output I am getting
>
> > >    -
>
> > >    result: Success     time: 0s    memory: 1720 kB     returned value: 0
> > >     input: no
> > >     output:
>
> > >    HelloHelloHelloHelloHelloHelloHelloHelloHelloHello
>
> > > On Thu, Sep 22, 2011 at 1:40 AM, teja bala 
> > > <pawanjalsa.t...@gmail.com>wrote:
>
> > >> @ ravi but compile it onhttp://ideone.com/nkTVN it showing 45 hello plz
> > >> do look at it.......
>
> > >> On Thu, Sep 22, 2011 at 12:59 AM, Rashmi Jain 
> > >> <rashmi.jain...@gmail.com>wrote:
>
> > >>> @ravi: thanks..!!
>
> > >>> On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon 
> > >>> <maggonr...@gmail.com>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 <rashmi.jain...@gmail.com
> > >>>> > 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 
> > >>>>> <maggonr...@gmail.com>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 
> > >>>>>> <anilarya...@gmail.com>wrote:
>
> > >>>>>>>http://ideone.com/nkTVN
>
> > >>>>>>> On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar <
> > >>>>>>> saravana....@gmail.com> wrote:
>
> > >>>>>>>> "Hello" will be printed 45 times...
>
> > >>>>>>>> On Wed, Sep 21, 2011 at 7:57 PM, sush57 
> > >>>>>>>> <sushaant...@gmail.com>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 algogeeks@googlegroups.com.
> > >>>>>>>>> To unsubscribe from this group, send email to
> > >>>>>>>>> algogeeks+unsubscr...@googlegroups.com.
> > >>>>>>>>> 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 algogeeks@googlegroups.com.
> > >>>>>>>> To unsubscribe from this group, send email to
> > >>>>>>>> algogeeks+unsubscr...@googlegroups.com.
> > >>>>>>>> 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 algogeeks@googlegroups.com.
> > >>>>>>> To unsubscribe from this group, send email to
> > >>>>>>> algogeeks+unsubscr...@googlegroups.com.
> > >>>>>>> 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 algogeeks@googlegroups.com.
> > >>>>>> To unsubscribe from this group, send email to
> > >>>>>> algogeeks+unsubscr...@googlegroups.com.
> > >>>>>> 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 algogeeks@googlegroups.com.
> > >>>>> To unsubscribe from this group, send email to
> > >>>>> algogeeks+unsubscr...@googlegroups.com.
> > >>>>> 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 algogeeks@googlegroups.com.
> > >>>> To unsubscribe from this group, send email to
> > >>>> algogeeks+unsubscr...@googlegroups.com.
> > >>>> 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 algogeeks@googlegroups.com.
> > >>> To unsubscribe from this group, send email to
> > >>> algogeeks+unsubscr...@googlegroups.com.
> > >>> 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 algogeeks@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> algogeeks+unsubscr...@googlegroups.com.
> > >> 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 algogeeks@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > algogeeks+unsubscr...@googlegroups.com.
> > > 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to