/* include header files */

#include <stdio.h>       // printf
#include <unistd.h>      // getpid, getppid, fork
#include <sys/types.h>   // getpid, getppid, fork

/* main function */

int main(){          
  
  if (fork() == 0) {     // we don't need to remember the result 
			 // of the fork() function, so just compare 
			 // it with 0
    /* child section */
    
    printf("Child: my PID is %d, and my parent's PID (ie. PPID) is %d\n", getpid(), getppid());
    sleep(10);
  }
  else {
    
    /* parent section */
    
    printf("Parent: my PID is %d, and my parent's PID (ie. PPID) is %d\n",getpid(),getppid());
    sleep(10);
  } 
  
  printf("End\n");
  return 0;
}

