
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>

int main()
{
    int fd[2];
    pipe(fd);

    if(fork()==0)
    {
        close(fd[0]);
        printf("Child PID = %d\n",getpid());
        close(fd[1]);
        exit(0);
    }
    else
    {
        close(fd[1]);
        wait(NULL);
        printf("Parent PID = %d\n",getpid());
        close(fd[0]);
    }

    return 0;
}
