Test yourself on Variable Scope with exam style questions, marked instantly.
Flashcards that come back just before you would forget them.
A revision plan that remembers what you know and shows what to do next.
See which topics you have nailed and which need another look.
Quiz yourself on Variable ScopeGet your flashcardsBuild my revision planTrack my progressLocal vs Global
| Aspect | Local Variable | Global Variable |
|---|---|---|
| Declared | Inside a subprogram | Outside all subprograms |
| Accessible | Only within that subprogram | Anywhere in the program |
| Lifetime | Created when function runs, destroyed when it ends | Exists for entire program |
| Memory | Efficient - freed when not needed | Uses memory entire time |
| Safety | Can't be accidentally changed elsewhere | Can be changed from anywhere |
Make this stick
Signing in gives access to all PrepWise features.