
Why it is printing two "Hi" in the above program? Is fork() call compiler dependent?

Why it is printing two "Hi" in the above program? Is fork() call compiler dependent?
I think your question has been answered in the comments. But all the same, the child process basically inherits the buffer of the parent. As far as I know, the stdout buffer doesn't print, as mentioned by Jochaim Pileborg, till either of buffer being full, newline in the printf, or stdout being closed.
In this case, none of them happen before the child process is created. Now the parent's buffer containing "Hi" is copied as such to the child's buffer. When both the parent and the child finishes execution, the stdout is closed, and hence the output is flushed from each. This results in your two "Hi".