C Program to create a child process using fork system call and print PID and PPID of the processes

Program

#include<stdio.h>
#include<unistd.h>
void main()
{
	pid_t p;
	printf("pid of main program:\t%d\n", getpid());
	p = fork();
	if(p == 0)
	{
		printf("In child process,\tpid:\t%d,\tppid:\t%d\n", getpid(), getppid());
	}
	else
	{
		printf("In parent,\t\tpid:\t%d,\tfork returned:\t%d\n", getpid(), p);
	}
}

Output

pid of main program:	4717
In parent,		pid:	4717,	fork returned:	4718
In child process,	pid:	4718,	ppid:	4717v