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

void child()  
{
	printf("PID %d is child\n",getpid());
	sleep(2);
	printf("child is exiting\n");
	exit(0);
}

void parent()
{
	int p_return;
	p_return=wait(NULL);
	printf("PID %d is parent, wait return from %d.\n",getpid,p_return);
}

main()
{
	pid_t pid;
	pid=fork();
	if(pid<0) perror("fork");
	else if(pid==0)  child();
	else   parent();
}
