title: Declarations/definitions as statements in C and C++
body: <p>I was confused when this wouldn't compile in C:</p>
  
  <pre><code>int main()
  {
      for (int i = 0; i &lt; 4; ++i)
          int a = 5; // A dependent statement may not be declaration
  
      return 0;
  }
  </code></pre>
  
  <p>I'm used to C++ where this will compile. I just stared dumbfounded for a while until I remembered an answer here on SO about how in C and C++ different things are considered "statements". This was in regard to a switch statement. A "statement" after the for loop brackets must be present both in C and C++. This can be done in both either adding a semicolon or creating a { } squiggly bracket block. </p>
  
  <p>In C++ "int a = 7;" is considered a declaration, definition, and initialisation. In C I believe it is also considered all of these, however in C it is not considered a "statement". </p>
  
  <p>Could someone exactly clarify why in C this isn't a statement whereas in C++ it is? This is confusing my concept of what a statement is, because one language says it is, and another says it isn't, so I'm kind of confused.  </p>