Q:

Fork Programming in C at Linux Environment

Can anyone help me to know the fork process in c Programming and how it's working on the real time application.And sample program for that.

A:

#include <stdio.h>
#include <unistd.h> 

int main()
{
    pid_t pid;
    pid = fork();

    if(pid == 0){
        printf("child process\n");
    }
    else{
        printf("parent process\n");
    }
    return 0;
}

