#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    pid_t ret;
    ret = fork();
    if (ret == -1) {
	perror("fork returned -1");
	exit(EXIT_FAILURE);
    }
    printf("The value of ret is  %d !. Which is either parent's or child's process id (PID)'\n", ret);
    if (ret == 0) {
	pid_t mypid = getpid();
	printf("The child says, \"my pid is %d.\"'\n", mypid);
    } else {
	printf("Just became parent of %d.'\n", ret);
    }
    pid_t mypid = getpid();
    printf("pid %d says hello!'\n", mypid);
    return EXIT_SUCCESS;
}
