<分区>
我想知道这个程序的输出是关于系统调用的。我试图理解,但这很难。
int main (void) {
pid_t pid;
pid = fork();
if (pid > 0) {
int i;
for (i = 0; i < 5; i++) {
printf(" I AM VU : %d\n", i);
sleep(1);
}
exit(0);
}
else if (pid == 0) {
int j;
for (j = 0; j < 5; j++) {
printf(" I have no child: %d\n", j);
sleep(1);
}
exit(0);
} else {
fprintf(stderr, "can't fork, error %d\n", errno);
exit (EXIT_FAILURE);
}
}