#include<sys/types.h>
#include<stdio.h>
#include<stdlib.h>
int main()
{
int pid;
pid=fork();
if(pid==0)
{
printf("\n the process id of child is %d",getpid());
printf("\n the parent process id of child is %d",getppid());
}
else
{
printf("\n the process id of parent is %d",getpid());
printf("\n the parent process id of parent is %d",getppid());
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main()
{
int pid;
pid=fork();
if(pid==0)
{
printf("\n the process id of child is %d",getpid());
printf("\n the parent process id of child is %d",getppid());
}
else
{
printf("\n the process id of parent is %d",getpid());
printf("\n the parent process id of parent is %d",getppid());
}
return 0;
}
No comments:
Post a Comment