fork()

Q

main() {
  int i = 2;
  int ret_val;
  while(i > 0) {
    ret_val = fork();
    if (ret_val==0) {
      printf(“In child %d. \n”, i);
    } else{
      printf(“In parent %d. \n”, i);}
      i=i-1;
    }
  }
}

✍: Guest

A
The logic of this code looks clear. But what is the question?

2009-04-19, 5003👍, 0💬