fork download
  1. /* main program illustrating the UNIX fork() system call.
  2. Compile using cc -o main main.c
  3. */
  4. #include <stdio.h>
  5. main() {
  6. fork();
  7. int pid = fork();
  8. printf("hello1 ");
  9. if(pid > 0 )
  10. {
  11. fork();
  12. if(pid == 0)
  13. printf("hello");
  14. }
  15.  
  16. }
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
hello1