printf("My 1st fork example.\n"); printf("-----------------------\n"); printf("-----------------------"); if((pid1 = fork())== 0){ printf("I am child, my ID is %d, my parent's ID is %d.\n", pid1, getppid()); sleep(2); } elseif((pid2 = fork())== 0) printf("I am another child, my real ID is %d, however, I return as %d.\n", getpid(), pid2); else{ printf("I am Daddy. My children's ID is %d and %d\n", pid1, pid2); sleep(3); } printf("test complete.\n"); return 0; }