Here is my code:
int main(int arg, char *argv[]){
short pid;
if((pid = fork()) == 0){
printf("Child is running\n");
while(1) ;
} else {
printf("Parent is running\n");
}
}
After running this, only "Parent is running" is printed to the console. If I remove the while loop, both statements are printed to the console. Why is the while loop causing the child's print statement to be ignored if it appears before it?