If you define a variable (like pi3
) outside any blocks, it will be a global variable.
In C++, a block delimits a static scope. Any variables declared in the block are available only within that block; they will not be available outside of the block.
An uninitialized variable will have an indeterminate value -- it could be anything! In the case of a pointer, it could point anywhere...
Stereotypically, the data in an uninitialized variable is "whatever data happened to be written to that space beforehand, because we were too lazy to wipe it." It turns out there is a reason for being that lazy: if you define a large local variable (such as long array), automatically wiping the data could be a real performance hit. So, the default is to leave it uninitialized.