#include<stdio.h>
int main() {
        int id,i;

        if((id=vfork())==0) {           //child
                printf("in child\n");
                sleep(3);
                printf("%d\n",i);
        }
        else {                          //parent
                printf("in parent\n");
                scanf("%d",&i);
                sleep(1);
                printf("%d\n",i);
        }
        return 0;
}

can anybody answer why output of this program going in a loop.
(tested on  gcc 4.4 compiler)

-- 
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