The error I am getting on compiling the following code is undefined reference to 'fork' undefined reference to 'getppid' error: ld returned 1 exit status
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
int main()
{
int pid;
pid=fork(); //creates child process and stores the return value
if(pid>0)
printf("parent process id:%d",getpid()); //prints the process id
else if(pid==0)
printf("Child process id:%d parent id:%d Parent process id:%d",getpid(),getppid()); //prints the process and parent id
else
printf("Error");
return 0;
}