- Where Developers Learn, Share, & Build Careers


In a tutorial he said

If you use the Goto statement to jump mid The automatic variable of the block is not started.

Then if I can be accessed / declared in the code below, why is not it started?

  int main () {hereo here; {Int i = 10; Here: printf ("% d \ n", i); } Return 0; }   

ps: Output is some garbage value.

there is no logic behind your question "if i Can be reached, why ... ". Despite being able to "access i ", there is no argument for something or against it, this means that the printf statement is the same as the I . However, since you jumped on the starters, then the variable has not been started (like your tutorial says).

Reading an unexpired variable is an undefined behavior, so your program is bad.

Memory is already kept separate on compiled time for the variable i , because the variable exists inside the internal block. Memory is not dynamically allocated, as you can imagine. It is already there, but it has never been fixed due to goto .

The rule of thumb: Do not jump in early start.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -