An expert programmer decided to use multiple processes to do a simple job. (For the purposes of this problem, we'll ignore the sanity aspects of this design.)

The program executes, but the programmer gets more than he expects.


#include <stdio.h>

#include <unistd.h>

int main()

{

    printf("Hello ");

    if (fork() == 0) {

        printf("World\n");

    }

    return (0);

}

Source code

Hint 1: The program outputs more than just "Hello World".

Hint 2: A fork make an exact duplicate of the program.

Next Hint
Answer

Main gallery