fork download
  1. #include <stdio.h>
  2. #include <unistd.h>
  3.  
  4. int main() {
  5. printf("hello\n");
  6. switch(fork()) {
  7. case 0:
  8. printf("hello\n");
  9. if(fork())
  10. fork();
  11. break;
  12. default:
  13. if(fork() == 0) {
  14. printf("hello\n");
  15. fork();
  16.  
  17. } else {
  18. printf("hello\n");
  19. if(fork() == 0)
  20. printf("hello\n");
  21. }
  22. }
  23. printf("hello\n");
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello