fork download
  1. #include<stdio.h>
  2. #include<sys/types.h>
  3. #include<unistd.h>
  4. void forkexample(){
  5. int x = 1;
  6.  
  7. if (fork()==0){
  8. printf("Child has been executed x=%d\n",++x);
  9. }
  10. else{
  11. //printf("Parent has been executed x=%d\n",--x);
  12. }
  13. }
  14.  
  15. int main() {
  16. void forkexample();
  17. return 0;
  18.  
  19. }
Success #stdin #stdout 0s 5476KB
stdin
0
stdout
Standard output is empty