Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<sys/wait.h>
- int main(){
- int pid;
- pid=fork();
- if(pid==0){
- printf("nI am the child and my parent id is - %d and mine id %dn",getppid(),getpid());
- }
- else
- printf("nI am the parent and my pid is %d and my parent id is %dn",getpid(),getppid());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement