Computer Science, asked by ArpitaDas1, 1 year ago

What is global variables and local variables?

Answers

Answered by Anonymous
4
global variable :- In computer programming, a global variable is a
variable with global scope, meaning that it is visible (hence accessible) throughout the program, unless shadowed. The set of all global variables is known as the global environment or
global state.
local variable :- In computer science, a local variable is a
variable that is given local scope. Local variable references in the function or block in which it is declared override the same variable name in the larger scope.

ArpitaDas1: thanks..
Anonymous: still waiting...
vanshiangel: ryt answer
ArpitaDas1: yeah.
ArpitaDas1: r8
no2: nice answer
Answered by Anonymous
4
Global variables are declared outside any function, and they can be accessed (used) on any function in the program. Local variables are declared inside a function, and can be used only inside that function. It is possible to have local variables with the same name in different functions.
Similar questions