#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

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

	printf("The parent process has pid %d\n", getpid());
	fflush(stdout);

	pid = fork();

	if (pid < 0) {
		fprintf(stderr, "fork()");
		exit(1);

	} else if (pid == 0) {
		printf("I'm the child process (pid= %d)\n", getpid());
		fflush(stdout);

	} else {
		printf("I'm the parent process\n");
		fflush(stdout);
	}

	exit(0);
}
