What is the difference between local and global variables?

Local variables are defined within a subroutine. Their scope/visibility ends when the cursor leaves the subroutine.
Global variables on the other hand are variables that exist outside of all the subroutines and functions, and are available to all of them.

CD

Related Computing A Level answers

All answers ▸

Describe what is meant by a modular design and state on advantage of a modular design.


Write a Pseudocode function that returns the factorial of an integer input.


A computer stores floating point numbers of size 1 byte, with 3 bits for the mantissa and 5 bits for the exponent. State what the effects would be on the stored numbers if instead 5 bits were used for the mantissa and 3 bits were used for the exponent.


Give two types of management of either hardware or other resources that are performed by an operating system.