Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <unistd.h>
- int main(){
- int pid1,pid2;
- pid1 = fork();
- if(pid1){
- printf("parent\n");
- printf("child 1 pid %d \n", pid1);
- pid2 = fork();
- if(pid2){
- printf("child 2 pid %d \n", pid2);
- }else{
- printf("child2\n");
- }
- }else{
- printf("child1\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement