fork download
  1. /* Write a program (using fork() and/or exec()commands) where parent and child execute same program same code*/
  2. #include <iostream>
  3. #include <unistd.h>
  4. using namespace std;
  5. int main(){
  6. int x;
  7. x=fork();
  8. std::cout<<x;
  9. std::cout<<"Hello";
  10. }
  11.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
4156424Hello0Hello