What is meant by Scope of a variable?

Posted by Appy on Programmers See other posts from Programmers or by Appy
Published on 2012-03-23T07:17:16Z Indexed on 2012/03/23 11:38 UTC
Read the original article Hit count: 373

Filed under:
|
|
|
|

I think of the scope of a variable as -

"The scope of a particular variable is the range within a program's source code in which that variable is recognized by the compiler".

That statement is from "Scope and Lifetime of Variables in C++", which I read many months ago.

Recently I came across this in LeMoyne-Owen College courses:

http://sankofa.loc.edu/CHU/WEB/Courses/Cosi350/Ch4/scope.13.gif

What exactly is the difference between the scope of variables in C# and (C99, C++, Java) when

However a variable still must be declared before it can be used

© Programmers or respective owner

Related posts about java

Related posts about c#