home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / cpptutor / cpptutor.arj / EXAMPLES / EX0420.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-05  |  395 b   |  14 lines

  1. // \EXAMPLES\EX0420.CPP
  2. #include <iostream.h>
  3.  
  4. void main() {
  5.    float x = 99.9;  // x declared as a float in enclosing block
  6.    {
  7.       int x = 0;    // x declared as an int in the enclosed block
  8.       int y = 1;
  9.       cout << "Here is x in the nested block: " << x << endl;
  10.    }
  11.    cout << "Here is x in outer block: " << x << endl;
  12.    // y is not visible in the enclosing block
  13. }
  14.