Please write a C program that does the following things:
a. It shows it own pid and ppid on the screen.
b. It creates a child process. The parent process shows then the pid of this child process, it sleeps for one second and outputs a message on the screen saying that it will exit.
c. The child process shows its pid and ppid on the screen. It sleeps for 5 seconds and outputs its pid and ppid again on the screen before it exits.
d. Redirect the outputs of the program to a temp file and compare the contents of this file with those directly shown on the screen. You will find that they are different! But both are correct! Could you explain the reason for the differences?
d. Redirect the outputs of the program to a temp file and compare the contents of this file with those directly shown on the screen. You will find that they are different! But both are correct! Could you explain the reason for the differences?