title: Why use pointers in C++?
body: <p>I am learning C++ from a game development standpoint coming from long time development in C# not related to gaming, but am having a fairly difficult time grasping the concept/use of pointers and de-referencing. I have read the two chapters in my current classes textbook literally 3 times and even googled some different pages relating to them, but it doesn't seem to be coming together all that well.</p>
  
  <p>I think I get this part:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
      int myValue   = 5;
      int* myPointer = nullptr;
  
      std::cout &lt;&lt; "My value: " &lt;&lt; myValue &lt;&lt; std::endl; // Returns value of 5.
      std::cout &lt;&lt; "My Pointer: " &lt;&lt; &amp;myValue &lt;&lt; std::endl; // Returns some hex address.
  
      myPointer  = &amp;myValue; // This would set it to the address of memory.
      *myPointer = 10; // Essentially sets myValue to 10.
  
      std::cout &lt;&lt; "My value: " &lt;&lt; myValue &lt;&lt; std::endl; // Returns value of 10.
      std::cout &lt;&lt; "My Pointer: " &lt;&lt; &amp;myValue &lt;&lt; std::endl; // Returns same hex address.
  }
  </code></pre>
  
  <p>I think what I'm not getting is, why? Why not just say myValue = 5, then myValue = 10? What is the purpose in going through the added layer for another variable or pointer? Any helpful input, real life uses or links to some reading that would help make sense of this would be GREATLY appreciated!</p>