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 ▸

Define resolution in regards to images and how it differs from colour depth


How do I solve a Karnaugh Map?


Describe the 4 layers of the TCP/IP model


Convert 10101100 to decimal.