fork(1) download
#include <iostream>
#include <unistd.h>
#include <sys/wait.h>
using namespace std;

int main(int argc, char* argv[]) {

    pid_t ret1 = 0;
    pid_t ret2 = 0;
    for (int i = 0; i < 3 ; i ++)
    { 
    ret1 = fork(); 
    if ( ret1 != 0)
    break;
    else
    ret2 = fork(); 
    }
    printf ( "hello\n" );
}


Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
hello