Variable Declaration
This declaration of variables in the C language is permitted only in the starting of their block, prior to executable program statements. In C++ declaration of variables can be interspersed with executable program statements. The scope id variables, though, remains the same - the block in which they are declared.
e.g.
void main()
{
int x = 10;
printf (" the value of x= % d\n",x);
int y = 0;
for( int z= 0; z < 10; ; z++) // variable declared
here.
{
y ++;
x ++;
}
}
Although, a deviation from the old style of declaring all variables in the starting of the block, this does save some amount of memory, i.e., a variable is not given a memory unless the declaration statement. Also, as a variable can be declared just before using it is assume to give a better control over variables.