C Program to create a child process using fork system call
Program
#include<stdio.h>
#include<unistd.h>
void main()
{
pid_t p;
p = fork();
printf("fork returned %d\n", p);
}
Output
fork returned 4705
fork returned 0
Program
#include<stdio.h>
#include<unistd.h>
void main()
{
pid_t p;
p = fork();
printf("fork returned %d\n", p);
}
Output
fork returned 4705
fork returned 0