Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<unistd.h>
- #include<stdlib.h>
- void main(){
- int a,pid;
- printf("Do you want to create a process? Press 1 for Yes ");
- scanf("%d",&a);
- if (a==1){
- fork();}
- else{printf("Fair enough");}
- printf("This should print twice");
- if (pid<0){printf(" Child process not created ");}
- else if (pid>0){printf(" This is the parent process ");}
- else{printf(" This is the child process ");}}
- >Do you want to create a process? Press 1 for Yes 1
- >This should print twice This is the child process This should print twice This is the child process
- >This should be printed twice
- >This is child process
- >This should be printed twice
- >This is parent process
Add Comment
Please, Sign In to add comment