title: How can I declare a structure in C++ without defining it?
body: <p>I have been following a tutorial at <a href="http://cplusplus.com/doc/tutorial" rel="nofollow">cplusplus.com/doc/tutorial</a>. Near the end of the Functions page, it discussed prototyping a function. Later on, I read about structures. I thought it looked a little messy, and I like my code blocks after my main method. So I wondered if I could prototype a data structure. I tried this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  struct aStruct;
  
  int main() {
  
      aStruct structure;
  
      structure.a = 1;
      structure.b = 2;
  
      cout &lt;&lt; structure.a &lt;&lt; ", " &lt;&lt; structure.b &lt;&lt; "\n";
  
      return 0;
  }
  
  struct aStruct {
      int a;
      int b;
  };
  </code></pre>
  
  <p>But my IDE said that "aStruct was not declared in this scope". <strong>So, how would I prototype a data structure so the bulk of it can be below the main method?</strong></p>
  
  <p>The tutorial pages:
  <a href="http://www.cplusplus.com/doc/tutorial/functions/" rel="nofollow">Functions</a>
  <a href="http://www.cplusplus.com/doc/tutorial/structures/" rel="nofollow">Data strucutres</a></p>