fork download
  1. #include<stdio.h>
  2. #include<unistd.h>
  3.  
  4. int main(){
  5. int pid;
  6. pid = fork();
  7. if(pid==0){
  8. printf("The id of the parent process is ::%d\n",getppid());
  9.  
  10. printf("The id of the current process is ::%d\n",getpid());
  11. }
  12. return 0;
  13. }
  14.  
  15.  
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
The id of the parent process is ::1
The id of the current process is ::1364429