title: fork() is returning a number greater than 0
body: <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;signal.h&gt;
  #include &lt;sys/types.h&gt;
  // Curtis    
  void kloop(int x)
  {
      int breakCondition;
      breakCondition = 0;
      while(1)
      {
              printf("Process %d running\n", x);
              sleep(1);
  
              breakCondition = breakCondition + 1;
              if (breakCondition == 5)
              {
                      break;
              }
      }
  }
  </code></pre>
  
  <p>//---------------</p>
  
  <pre><code>void makeChild()
  {
      int status;
      pid_t pid;
      pid = fork();
  
      printf("fork number %d\n", pid);
      printf("processid: %d", getpid());
  
      if (pid &lt; 0)
      {
              printf("You done messed up.\n");
      }
      else if (pid == 0)
      {
              printf("You are in child process %d\n", getpid());
      }
      else
      {
              printf("You ain't no kid.\n");
      }
  
      printf("fork number after if/else:  %d\n", pid);
      printf("processid after if/else:  %d\n", getpid());
  }
  </code></pre>
  
  <p>//---------------</p>
  
  <pre><code>int main()
  {
      int status;
      int n;
      printf("How many child processes do you want to create?\n");
      scanf("%d", &amp;n);
  
      printf("\n");
  
      kloop(n);
  
      int i;
      for (i=0;i&lt;n;i++)
      {
              //printf("\t'i' at %d", i);
              makeChild();
      }
      return 0;
  }
  </code></pre>
  
  <p>This is a .c file and I'm using gcc and ./a.out to run it in the terminal.
  When I've used fork before, it usually gives me a value equal to 0 or less.
  In this case, it looks like a processid.</p>
  
  <p>Here is an example of an output:</p>
  
  <p>How many child processes do you want to create?</p>
  
  <p>1</p>
  
  <p>Process 1 running</p>
  
  <p>Process 1 running</p>
  
  <p>Process 1 running</p>
  
  <p>Process 1 running</p>
  
  <p>Process 1 running</p>
  
  <p>fork number 10572</p>
  
  <p>processid: 10566You ain't no kid.</p>
  
  <p>fork number after if/else:  10572</p>
  
  <p>processid after if/else:  10566</p>
  
  <p>fork number 0</p>
  
  <p>processid: 10572You are in child process 10572</p>
  
  <p>fork number after if/else:  0</p>
  
  <p>processid after if/else:  10572</p>