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
Answered by Chris D. Computing tutor

8404 Views

See similar Computing A Level tutors

Related Computing A Level answers

All answers ▸

Describe the difference between passing parameters into a function by reference and by value? Indicating how this may lead to unexpected outputs.


Explain how a stack could be used in the process of evaluating an expression in Reverse Polish notation.


How to manually convert a number from decimal into binary?


Describe the operations of an optical disk drive used to read data from an optical disk, such as a CD or DVD.


We're here to help

contact us iconContact ustelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

MyTutor is part of the IXL family of brands:

© 2026 by IXL Learning