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 Round Robin Scheduling


Write pseudocode for the linear search algorithm, and then explain it’s complexity using big-O notation


In a computer program, a parameter may be passed to a procedure by value. Explain how this method works.


What is the difference between a dynamic and a static data structure?