Fork and \n

Hi,
I wrote a simple program for understanding the fork command. The code is as below

int main(void)
{
fork(); printf("hi 1 \n");
fork(); printf("hi 2 \n");
fork(); printf("hi 3 \n");
}

I am getting a variation in the number of times the printf is called if i remove the \n from each of the printf statements :confused: . Can anyone explain me why this is happening.

Thanks in Advance,

bye.

No duplicate or cross-posting, read the rules.

Proceed here:

http://www.unix.com/unix-dummies-questions-answers/65330-fork-n.html\#post302195622

Thread closed.