Vivek Shivu wrote:
> int a=20; // Global variable
> int main()
> {
> clrscr();
> {
> int a; // Local Variable
> a=10;
> printf("Local Variable = %d \n",a); // It prints 10 LocalVariable Value
> }
> printf(" global Variable Value = %d\n",a); // It should print Global
> Variable Value
> getch();
> }
> 
> 
>  this is based on the life of a variable within a block....
> hope tis helped u.....
> 
> Vivek

Oops.  I keep forgetting about block level scope locality.

It is just better to not create names that collide with each other. 
Then you don't have to worry about it.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to