Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1.     main() {
  2.         auto {
  3.             a = 2 + 3;
  4.             x = new X();
  5.             {
  6.               int b = a + 5;
  7.             }
  8.             //here b is out of scope!
  9.              //But if i declare b using 'auto' in this way:
  10.             auto {
  11.                 b = a + 5;
  12.             }
  13.             new_var = b + a; //b is visible
  14.             {
  15.                 auto example = 2;
  16.             }
  17.             //here example is out of scope!
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement