title: c++ pointer to array of structs
body: <p>Can someone please explain to me why this doesn't work?</p>
  
  <pre><code>struct person {
    string name;
    int age;
  };
  
  // in function
  person friends[NUM_OF_FRIENDS];
  friends[0].name = "bob";
  friends[1].name = "bill";
  friends[2].name = "liz";
  friends[3].name = "frank";
  friends[4].name = "carl";
  friends[0].age = 20;
  friends[1].age = 30;
  friends[2].age = 32;
  friends[3].age = 10;
  friends[4].age = 85;
  
  // array of pointers
  
  person (*friends_ptrs)[NUM_OF_FRIENDS] = &amp;friends;
  
  cout &lt;&lt; friends_ptrs[0]-&gt;name &lt;&lt; endl;
  
  cout &lt;&lt; friends_ptrs[1]-&gt;name &lt;&lt; endl;
  </code></pre>
  
  <p>"bob" is printed fine, but "bill" causes an error. How can "bob" print at all while "bill" is not found?</p>
  
  <p>I realize that I can just do this:</p>
  
  <pre><code>person *friends_ptrs = friends;
  </code></pre>
  
  <p>But then I'm not using the arrow notation, and it defeats the purpose of this exercise.</p>
  
  <p>So how can I access the friends[] struct, using a pointer with arrow notation?</p>