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

int main(int argc, char **argv)
{
  int i;
  int status;
  char dummy;

  pid_t pid = fork();

  if (pid == 0)
    {
      // child process gets here

      // child does some work

      exit(9);
    }
  else
    {
     // parent process gets here

      pid = wait(&status);

      printf("%x\n", WEXITSTATUS(status));
    }
 }
