title: c++ Accessing members of objects using pointers
body: <p>I have variable <code>mode</code>, which I am declaring with the following line:</p>
  
  <pre><code>StatusRecord mode;
  </code></pre>
  
  <p><code>StatusRecord</code> is a <code>struct</code> which holds several variables of different types.</p>
  
  <p>I now want to create a pointer to <code>mode</code>, and populate that pointer with some data by using a function to populate its attributes/ fields. I have tried doing this as follows:</p>
  
  <pre><code>StatusRecord mode;
  StatusRecord *modePtr = &amp;mode;
  DataStore-&gt;getModeData(*modePtr);
  </code></pre>
  
  <p>Here, I am declaring the <code>struct</code> variable, creating a pointer to it, and populating that pointer using the <code>getModeData()</code> function. However, I now want to use an attribute of the <code>struct ptr</code> I've just populated in a conditional statement:</p>
  
  <pre><code>if(*modePtr-&gt;eraseSelect ==2){
      ...
  }
  </code></pre>
  
  <p>But I'm getting a compile error on this line that says:</p>
  
  <blockquote>
    <p>Error: operand of '*' must be a pointer</p>
  </blockquote>
  
  <p>Does this mean that the <code>eraseSelect</code> attribute should be a pointer as well as 'modePtr`? How would I fix this error?</p>