devxlogo

October 16, 1998

The Scope of A Local Loop Counter

C++ allows you to declare variables wherever you need them, thus enabling immediate initializations. A good example is a loop counter. It can (and should) be declared inside a for-statement: