Variable scope behavior c language

Code snippet:

void function(void)
         int i = 0;
         i += 1;
         if(i == 500) break;

The variable i is stored in stack every time when restart the loop ?
What is the memory structure when running this code ?
What is the behavior of this variable ?
It is a bad or good practice do this ?


Source: c#

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.