World's most popular travel blog for travel bloggers.

[Solved]: Difference between free and global variables

, , No Comments
Problem Detail: 

Is there any difference between free variable and global variable? Or they are just synonyms? In which situations I should use one or another?

Asked By : rook

Answered By : Gilles

They don't play in the same category.

The notion of free variable is relative to a scope. If a variable is present in a term (i.e. a subprogram) and its scope is larger than this term, then the variable is said to be free in that term.

A global variable is one whose scope is the whole program, or the whole file, or the whole module, or whatever scope is called "global" in the programming language you're considering.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/14038

 Ask a Question

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback