title: Error: invalid use of non-static data member in CPP
body: <p>I am new to C++ and I am trying to do the following:</p>
  
  <pre><code>class abc {
      public:
      int no_of_consumer;
      struct def {
          int p = 0;
          int c = 0;
      };
      def variable[no_of_consumer - 1];
  };
  
  int main() {
      abc obj1;
      obj1.no_of_consumer = 1;
  };
  </code></pre>
  
  <p>I want the variable <code>no_of_consumer</code> to be set by the <code>main()</code> function, so that I can use this variable to define a structure array for variable <code>def</code>. But I am getting this error:</p>
  
  <blockquote>
    <p>invalid use of non-static data member "no_of_consumer". </p>
  </blockquote>
  
  <p>Am I missing some concept here?</p>