The given answer is wrong. The output may be "HiHi" or "Hi". At the time of fork, printf might not have been executed and hence the code of printing might be copied to child as well. (printf is a non-blocking call). To avoid this behaviour, either we have to use fflush or use the return value of printf before calling fork.