fork download
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <stdlib.h>
  4. int main()
  5. {
  6. int x = 1;
  7. int returnValue = fork();
  8. if (returnValue == 0)
  9. {
  10. printf("Child, returnValue = %d \n", returnValue);
  11. }else
  12. {
  13. printf("Parent, returnValue = %d \n", returnValue);
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 4304KB
stdin
Standard input is empty
stdout
Parent, returnValue = 20641 
Child, returnValue = 0