/* a sample program that illustate the fuction wait(). */
#include <stdlib.h>
#include <sys/wait.h>

int main() {
    int pid;
    int stat;
    
    pid = fork();
    if(pid == 0) {
        printf(" This is child process, please wait\n");
        sleep(5);
    }
    else {
        waitpid(pid,&stat,0);  /* wait for the child process exit */
        printf(" The child process exit\n");
    }
}
