title: C++ Expression must have pointer-to-object type
body: <p>Dear stackoverflow helpful community,</p>
  
  <p>This is my first program using a pointer with a structure, and despite lots of research, I was not able to find what I was looking for. Please forgive me if this has already been responded to.</p>
  
  <p>I have a project for school where I have to define structures than use pointers array to store data. In this loop, I get the following error :</p>
  
  <blockquote>
    <p>Expression must have pointer-to-object type</p>
  </blockquote>
  
  <pre><code>for (int i = 0; i &lt; nbClerk; i++)
              {
                  cout&lt;&lt;"Number of hours: ";
                  cin&gt;&gt;c_info-&gt;hoursWorked[i];
              }
              break;
  </code></pre>
  
  <p>here's the whole code. thank you very much for your help</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;iomanip&gt;
  using namespace std;
  
  //structure defining Employee
  struct Employee
  {
      int hoursWorked;
      int hourRate;
      double overtime;
      string name;
      int empID;
  };
  
  //Function collecting and calculating info
  void employeeInfo(int nbOperator, int nbClerk){
  
      char classOfEmployee;
  
      Employee *c_info;
      c_info = new (nothrow) Employee[nbClerk];
  
      Employee *o_info;
      o_info = new (nothrow) Employee[nbOperator];
  
      cout&lt;&lt;"Select the class of employee (C=Clerk, O=Operator)";
      cin&gt;&gt;classOfEmployee;
  
      switch (tolower(classOfEmployee))
      {
      case 'c': 
          for (int i = 0; i &lt; nbClerk; i++)
          {
              cout&lt;&lt;"Number of hours: ";
              cin&gt;&gt;c_info-&gt;hoursWorked[i];
          }
          break;
      }
  }
  
  int main(){
      int nb1,nb2;
      cout&lt;&lt;"Nb Employee and nb of nb of operator: ";
      cin&gt;&gt;nb1&gt;&gt;nb2;
      nbEmployee(nb1, nb2);
      system("pause");
  }
  </code></pre>