title: What's actually going on with this pointer
body: <p>Here's where my confusion starts, so a null pointer is declared first. Then selection is executed running whatever input was given then the function randomEncounter comes.</p>
  
  <pre><code> cout &lt;&lt; "1) Move, 2) Rest, 3) View Stats, 4) Quit: ";
              cin &gt;&gt; selection;
  
              Monster* monster = 0;
              switch( selection )
              {
              case 1:
                  gameMap.movePlayer();
  
                  // Check for a random encounter.  This function
                  // returns a null pointer if no monsters are
                  // encountered.
                  monster = gameMap.checkRandomEncounter();
  
                  // 'monster' not null, run combat simulation.
                  if( monster != 0 )
  </code></pre>
  
  <p>So next when the function goes through, is </p>
  
  <pre><code>//refering to the once null pointer and now modifies something real?
  monster = new Monster 
  </code></pre>
  
  <p>Is </p>
  
  <pre><code>0 = gameMap.checkRandomEncounter();
  </code></pre>
  
  <p>Or is it pointing to nothing instead of the actually value of zero, and waits patiently to have something to point to? So</p>
  
  <pre><code>0 = null;
  </code></pre>
  
  <p>Until the function is ran: Here's the function</p>
  
  <pre><code>Monster* Map::checkRandomEncounter()
  {
      int roll = Random(0, 20);
  
      Monster* monster = 0;
  
      if( roll &lt;= 5 )
      {
          // No encounter, return a null pointer.
          return 0;
      }
      else if(roll &gt;= 6 &amp;&amp; roll &lt;= 10)
      {
          monster = new Monster("Orc", 10, 8, 200, 1, 
              "Short Sword", 2, 7);
  
          cout &lt;&lt; "You encountered an Orc!" &lt;&lt; endl;
          cout &lt;&lt; "Prepare for battle!" &lt;&lt; endl;
          cout &lt;&lt; endl;
      }
  </code></pre>
  
  <p>So does when there is an encounter:</p>
  
  <pre><code>monster = new Monster();
  </code></pre>
  
  <p>Does this modify the once null pointer to a now real object, or does this make a completely new object? I'm so confused how all this links together. Also in the function there is a second </p>
  
  <pre><code>Monster* monster = 0;
  </code></pre>
  
  <p>Where is this one used, and how does it get back to the calling function that there was an encounter. I realize its somehow going back through the pointer but definitely need some clarity</p>