TITLE: Declared scope begins inside declaration

[ This example adapted from "C++ Gotchas", tutorial notes
  copyright by Tom Cargill, p. 59. ]


#include <iostream.h>


int a[] = { 0, 1, 2, 3 };


int main ()
{
	for (int i = 0; i< 4; i++)
		cout << a[i] << " ";

	cout << endl;

	{
		int a [sizeof (a)] = { a[0], a[1], a[2], a[3] };

		for (int j = 0; j< 4; j++)
			cout << a[j] << " ";

		cout << endl;
	}

	return 0;
}


This program outputs (on one specific platform) is shown below.
For more information, see the ARM, p. 16.

0 1 2 3
-23 2389 2609 4


[ Note that reusing a name inside a block, although legal, should
  be avoided. It could lead to some bugs that are hard to find for
  tired eyes. ]

  
