Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <unistd.h>
  3.  
  4.  
  5. int main(){
  6. int pid1,pid2;
  7. pid1 = fork();
  8. if(pid1){
  9. printf("parent\n");
  10. printf("child 1 pid %d \n", pid1);
  11. pid2 = fork();
  12. if(pid2){
  13. printf("child 2 pid %d \n", pid2);
  14. }else{
  15. printf("child2\n");
  16. }
  17. }else{
  18. printf("child1\n");
  19. }
  20.  
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement