Social Icons

Friday, 23 August 2013

Using Fork Command getting Process Id Of Child

#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;

}

No comments:

Post a Comment

 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management