I'm learning fork() function under linux recently. I wrote a program.
#include<stdio.h>
int main(){
int p1, p2;
while((p1 = fork()) == -1);
if(p1 == 0)
printf("b");
else{
while((p2 = fork()) == -1);
if(p2 == 0)
printf("c");
else
printf("a");
}
}
After I compiled and run it, I got a unexpected percent sign.
But if I add \n after those letters, the percent sign disappears.
Is there anyone knows the reason?
And I have another question. Every time I reran the program, I got the same answer. It always shows "acb". The order is always the same. Why?

