C code for orphan process?

Answer:
#include<stdio.h>
#include<signal.h>
main()
{
int id;
printf("before fork()\n");
id=fork();
if(id==0)
{
printf("child has started %d \n",getpid());
printf("parent of this child %d \n",getppid());
}
else
{

printf("parent has started :%d\n ",getpid());
kill(getpid(),SIGKILL);
}
printf("after fork()\n");
}
First answer by ID3075708116. Last edit by ID3075708116. Question popularity: 1 [recommend question].