sorry for late reply but i think many guys faces this problem..

so just put exit(EXIT_SUCCESS) in each if block at the end.

so each process will get terminated after doing its job.

do not forget to include header file <stdlib.h>

like for eg
Code: cpp
if (filho1 == 0){
        printf("[%d] Sou o filho1!\n", getpid());
        printf("[%d] O meu pai : %d\n", getpid(), getppid());