title: Is it legal to declare structures in for loop of C++?
body: <p>I just experimented the following program in Gcc compiler. I wondered, Declared structure in for loop and working fine in GCC.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
        int i = 0;
        for(struct st{ int a{9}; }t; i&lt;3; i++)
              std::cout&lt;&lt;t.a&lt;&lt;std::endl;
  }
  </code></pre>
  
  <p>So, Is it legal to declare structures in <code>for</code> loop?</p>
  
  <p><a href="https://wandbox.org/permlink/5hnt1nPY95OEDp0b" rel="nofollow noreferrer">DEMO</a></p>