In a ProgrammingLanguage a variable is a name potentially associated with a value in the context of the SourceCode.

In the (meaningless) C/C++ code

int blarg() {

char c = 'a'; int count = 12; int i; for (int i=0 ; i < count ; i++)


return (int) c;


c, count and i are variables. i is a variable which is initially undefined (called unbound in some languages). In C and C++ function definitions are not variables, although they are in Lisp and Scheme. In pure functional programming and some contexts in other languages (like const variables in C/C++) variables cannot be changed.

Names associated with values in data (for example HashTables) are not considered variables because they are not in the context of SourceCode.

See also: MetaSyntacticVariable, Foo