What is a global number in computer?
Answers
Answer:
What is a global number in computer?
The scope of a variable refers to where in the program a variable or constant can be accessed. The scope of a variable can either be local to a particular subroutine or global to the whole program.
Explanation:
A local variable is a variable that is only accessible within a specific part of a program. Usually a local variable is declared inside a subroutine or is an argument that has been passed by value.
Local variables in different subroutines are allowed to have the same identifier (name). Such variables are distinct from each other, because the data of each variable is stored in a separate place in memory (RAM). Changing the value of a local variable in one subroutine will not affect the value of any local variables with the same identifier in other subroutines.
This is an example of two subroutines that calculate the amount of tax to pay, either the basic rate of 20% tax or the higher rate of 40%:
SUBROUTINE basic_tax_rate()
amount ← USERINPUT
tax ← amount * 0.2
OUTPUT tax
ENDSUBROUTINE
SUBROUTINE higher_tax_rate()
amount ← USERINPUT
tax ← amount * 0.4
OUTPUT tax
ENDSUBROUTINE
The variables amount and tax are local and only exist within the subroutine they are defined in. Any changes to amount or tax in one subroutine do not affect the value of amount or tax in the other subroutine.
In most modern programming languages, the RAM taken up by the local variables of a subroutine is released once the subroutine has finished running.
~~~XI0///xiomaysolon~❤️️~
#CarryOnLearning
❥TitaniumSquad❤❤
❥NCS_S0NG❤❤
❥LeagueOfLegends_Gaming❤❤
❥❥❥#❥GAM3R❤❤