Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
380 B
3
Indexable
#include<stdio.h> #include<unistd.h> main( )
{
int i, pid; pid=fork( ); if(pid== -1)
{
perror(“fork failed”); exit(0);
}
else if(pid==0)
{
printf(“\n Child process starts‟); for(i=0; i<5; i++)
{
printf(“\n Child process %d is called”, i);
}
printf(“\n Child process ends”);
}
else
{
wait(0);
printf(“\n Parent process ends”);
}
exit(0);
}