Lecture overview -- Keyboard shortcut: 'u'  Previous page: Declaring several names together -- Keyboard shortcut: 'p'  Next page: Constants -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Basic facilities - slide 8 : 42

Declarations as statements - declarations in conditions

Introduce and initialize a variable at the place where it is first used

It is possible to delare variables in a condition of an if statement

less-localized.cc
Declarations before statements - C89 Style.
localized.cc
A declaration is a statement in C++.
decl-in-if.cc
A declaration in the condition of an if.