Yes it will print 30+ times.
fork() --> it's create the the child process which copie's the address
stack of the parent process.
now when you will do fork();
look 1st iteration --> it wil break; ( if parent process scheduled 1st by
the kernel )
when 2nd iteration --> it will again fork in child process. and will print
hello once and dan goes to parent dan break.
when 3rd iteration -->  it will fork again and print hello twice and dan
break
when 4th iteration --> it will again fork and prnt hello 4 times i.e. hello
once by iteration and dan fork child will start process from start and dan
print hello 3 more times and dan parent will schedule and dan break.
and so on...

On 31 October 2012 11:49, tendua <bharat.kra...@gmail.com> wrote:

> \n also flushes the standard output buffer. If it is not present, it is
> possible that you have previously entered data in it. Flushing also means
> it forces printf to print on the screen as soon as \n is processed.
> Otherwise it is buffered output and you can never predict how long would OS
> buffer your output and when precisely it chooses to actually print.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/cNFex4s9a8UJ.
>
> 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