What do you understand by global declaration?
Answers
Answered by
2
When a variable is declared it normally has global scope, that is, it will be known inside user-defined functions without any further declaration. If, however, a declaration occurs inside the definition of a user-defined function, the variable becomes local to that function invocation and will not be visible outside of it, and will vanish when the function returns. The user may override this by prefixing the keyword GLOBAL to any declaration inside a function, thus creating a variable which will be identical in scope to one declared outside of any function. For example,
FUNCTION phi(z) global REAL x = z/2. ENDF
will create a variable x when function phi is called. Any existing global variable named xwill be destroyed.
FUNCTION phi(z) global REAL x = z/2. ENDF
will create a variable x when function phi is called. Any existing global variable named xwill be destroyed.
Answered by
7
Answer:
It is a function where variables are declared. It can be used on any function in the program. Also, local variables are declared within it. And it can be used as a inside of that function. There is a scope of variable refers which is visible and accessible. We can declare global variable in C which can hold their values.
Similar questions