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.

Reply via email to