the tree in the the attachment below
this is my code that I'm tried to write :
this is my code that I'm tried to write :
Code:
#include<sys/types.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
printf("the parent id %d" , getpid());
pid_t pid1,pid2,pid3;
for (j=0;j<3;j++)
{
pid1=fork();
printf("%d",getpid());
}
if (pid1==0)
{
pid2=fork();
elseif (pid3=fork();
}
if((pid2 == 0)&&(pid3 == 0))
{
if (pid1 !=0)
fork();
}
printf("the process id %d" , getpid());
return 0;
}
Comment