I'm trying to modify the following code to:

-display the process ID of the parent
-fork 16 child processes from the parent, displaying their process

I know this is a simple problem, but I'm having a lot of trouble figuring it out. So far, I've modified a few ways that end up giving me endless loops of created processes. Any help would be greatly appreciated.

Colin Spencely

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

main() {
  int child_pid ;
  printf("Parent process PID = %d\n", getpid()) ;  
  if ((child_pid = fork()) != 0) {                     
    waitpid(child_pid, (int *)NULL, WUNTRACED) ; 
  else {                        
    printf("Child process PID = %d\n", getpid()) ;