Scope

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/4

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:39 AM on 3/18/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

5 Terms

1
New cards

Global Scope

Variable defined outside a function, and outside a class

automatically initialized to 0

can be accessed by all functions

2
New cards

Local Scope

inside a function, formal parameter list, or inside a block
only exists in the respective one

destroyed when function returns

3
New cards

Block scope

inside if/while/etc.
destroyed when loop/block finishes

4
New cards

is same variable name in same scope allowed?

no

must not have same var name in same scope

even if type is different

compiler error

5
New cards

if same variable name in nested scope, eg. int j; (inside function), int j; (inside function’s block)

it picks the one in the same block, and the one defined above

Explore top flashcards

flashcards
Metabolism
60
Updated 339d ago
0.0(0)
flashcards
Sociology Course Review
122
Updated 1173d ago
0.0(0)
flashcards
physics sound and waves
65
Updated 1200d ago
0.0(0)
flashcards
Intouchables voc
101
Updated 1069d ago
0.0(0)
flashcards
AP Stats Ch. 4
45
Updated 1242d ago
0.0(0)
flashcards
Lecture 3
86
Updated 212d ago
0.0(0)
flashcards
Metabolism
60
Updated 339d ago
0.0(0)
flashcards
Sociology Course Review
122
Updated 1173d ago
0.0(0)
flashcards
physics sound and waves
65
Updated 1200d ago
0.0(0)
flashcards
Intouchables voc
101
Updated 1069d ago
0.0(0)
flashcards
AP Stats Ch. 4
45
Updated 1242d ago
0.0(0)
flashcards
Lecture 3
86
Updated 212d ago
0.0(0)