#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
int main()
{
int pid;
printf("The pid before fork:%d\n",getpid());
pid= fork();
if(pid<0)
printf("error!!!\n");
else if(pid ==0)
printf("I am the child,my pid is:%d\n ",getpid());
else
printf("I am the father,my pid is:%d\n",getpid());
printf("Hello Fork!\n");
return 0;}
#include<unistd.h>
#include<sys/types.h>
int main()
{
int pid;
printf("The pid before fork:%d\n",getpid());
pid= fork();
if(pid<0)
printf("error!!!\n");
else if(pid ==0)
printf("I am the child,my pid is:%d\n ",getpid());
else
printf("I am the father,my pid is:%d\n",getpid());
printf("Hello Fork!\n");
return 0;}