title: How can I print an array via pointer
body: <p>Our teacher gave this code and we need to get this code operational.</p>
  <p>How can I print the values inside of array?</p>
  <pre><code>cout &lt;&lt; wizardsCollection-&gt;birthYear;
  </code></pre>
  <p>is returns what I gave but <em>wizardsCollection-&gt;nameSurname</em> returns empty value.</p>
  <p>Here's the rest of the code:</p>
  <pre><code>struct Wizard {
      string nameSurname;
      int birthYear;
      string hairColour;
  };
  
  struct Wizard *createWizards() {
      Wizard wizardsCollection[3];
  
      for (int index = 0; index &lt; *(&amp;wizardsCollection + 1) - wizardsCollection; index = index + 1) {
          wizardsCollection[index].nameSurname = &quot;Name and surname of &quot; + index;
          wizardsCollection[index].birthYear = 0;
          wizardsCollection[index].hairColour = &quot;Hair colour of &quot; + index;
      }
  
      return wizardsCollection;
  }
  
  int main()
  {
      Wizard *wizardsCollection = createWizards();
      cout &lt;&lt; wizardsCollection-&gt;nameSurname;
  }
  </code></pre>