@albert:-
Here you go:-

#include <unistd.h>
#include<iostream>

using namespace std;


int Fork(int i)
{
cout<<endl<<"Fork"<<i<<" executed."<<endl;
return fork();
}
int main()
{
Fork(1);
Fork(2) && Fork (3) || Fork (4);
Fork (5);
}

Regards,
Prem


On Sat, Sep 4, 2010 at 11:41 PM, vikash jain <vikash.ro...@gmail.com> wrote:

> yes ..19 is the correct answer.
>
>                                                                     p(f1)
>                                                                    /  \
>                                                                  p1   p
>                                                                  (f2)  (f2)
>                                                                 / \       /
> \
>                                                                /   \
> /   \
>                                                              p2  p1  p11
> p(f3)
>                                                              (f4)  (f3)
> (f4)    /\
>                                                             /  \
> /\      /\   /  \
>                                                            /    \   /  \
> /  \  /   \
>                                                         p3   p2 p6 p1
>                                                         f5    f5   f4  f5
>                                                          and so on
> if fork2 returns zero then fork3 is not executed.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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