Only The Child Loops
#include <stdio.h>
#include <unistd.h>
int main(void) {
for (int i = 0; i < 3; i++) {
if (fork() > 0)
break;
}
printf("%d\n", (int) getpid());
return 0;
}
How many lines does this program print in total, and how are the resulting processes related?
Sign in to answer questions and track your progress
Sign In