i was implementing the fork command and came across this, why '\n' creating so much difference. i am getting different output if use \n. please have a run of this code
#include<stdio.h>
int main()
{
printf("hello %d\n ", getpid());
fork();
printf("news %d \n", getpid());
return 0;
}
#include<stdio.h>
int main()
{
printf("hello %d ", getpid());
fork();
printf("news %d", getpid());
return 0;
}
output1:
hello 4750
news 4750
news 4751
output2:
hello 4812 news 4812 hello 4812 news 4813