Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <wait.h>
  4.  
  5. int main(void) {
  6. int pid;
  7.  
  8. pid= fork();
  9. if (pid == 0) {
  10. fprintf(stdout, "An");
  11. pid= fork();
  12. if (pid==0) {
  13. fprintf(stdout, "Bn");
  14. pid=fork();
  15. fprintf(stdout, "Cn");
  16. }
  17. else {
  18. wait(NULL);
  19. fprintf(stdout, "Dn");
  20. }
  21. }
  22. else {
  23. fprintf(stdout, "En");
  24. wait(NULL);
  25. }
  26. // your code goes here
  27. return(0);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement