title: C++ Pointers and C-style array initialization
body: <p>Long time java programmer here, new to C++. I have been working with C-style &quot;traditional&quot; arrays (similar to arrays in java). I understand in C++ we can create a simple array as follows:</p>
  <p><code>Person people[3];</code></p>
  <p>The contents of this array is essentially uninitialized junk values. When I print out the contents of each element in the array, I (believe) am getting the memory address of each element.</p>
  <pre><code>for(int i = 0; i &lt; 3; i++){std::cout &lt;&lt; &amp;person[i] &lt;&lt; std::endl;}
  </code></pre>
  <p>Results:</p>
  <pre><code>//Note, I get different results here when I use an enhanced for loop vs an iterator for loop. Weird.
  00EFFB6C
  00EFFBA8
  00EFFBE4
  </code></pre>
  <p>Now, here is the part I have failed to get a clear explanation on. I create a pointer to one of the elements in the array. I then ask for some value <em>back</em> from that pointer. In java, I would expect to get a null pointer, but in C++, that is not happening.</p>
  <p>Instead, I get the default value, as though this element is initialized:</p>
  <pre><code>Person* person1Ptr = &amp;people[0];//Points to an uninitialized value
  std::cout &lt;&lt; person1Ptr-&gt;getFirstName() &lt;&lt; std::endl;//Output: &quot;Default First Name&quot;, expected nullptr
  </code></pre>
  <p>When I try to get the first name of an element using a reference, this doesn't work (presumably because the value doesn't exist).</p>
  <p>Full paste of code: <a href="https://pastebin.com/cEadfJhr" rel="nofollow noreferrer">https://pastebin.com/cEadfJhr</a></p>
  <p>From my research, C++ does NOT fill arrays with objects of the specified type automagically.</p>
  <p><strong>How is my person1Ptr returning a value?</strong></p>