The output of the below program is "hihi" as "hi" is printed by both parent and child process
[code=c]
#include<stdio. h>
main()
{
printf("hi");
fork();
}
[/code]
where as the output below program is
[code=c]
#include<stdio. h>
main()
{
printf("hi\n"); //observe the \n after hi
fork();
}
[/code]
is only "hi"
what's the reason?
[code=c]
#include<stdio. h>
main()
{
printf("hi");
fork();
}
[/code]
where as the output below program is
[code=c]
#include<stdio. h>
main()
{
printf("hi\n"); //observe the \n after hi
fork();
}
[/code]
is only "hi"
what's the reason?
Comment