Storage Classes Flashcards
1
Q
What are “Storage Classes”?
A
used for memory management in C. allow the user to change the scope, visibility, and lifetime of a variable
2
Q
What are the properties of a variable in the “auto” storage class? (Declaration, Storage, Uninitialized Value, Scope, Lifetime)
A
- Declared inside a function
- Stored in memory
- Uninitialized yields garbage values
- Scope is within the function
- Lifetime is within the function
3
Q
What are the properties of a variable in the “static” storage class? (Declaration, Storage, Uninitialized Value, Scope, Lifetime)
A
- Declared inside a function
- Stored in memory
- Uninitialized yields 0 value
- Scope is within the function
- Lifetime is the program runtime
4
Q
What are the properties of a variable in the “register” storage class? (Declaration, Storage, Uninitialized Value, Scope, Lifetime)
A
- Declared inside a function
- Stored in CPU registers
- Uninitialized as garbage
- Scope is within the function
- Lifetime is within the function
5
Q
What are the properties of a variable in the “extern” storage class? (Declaration, Storage, Uninitialized Value, Scope, Lifetime)
A
- Declared outside all functions
- Stored in memory
- Uninitialized as 0 value
- Scope is global (across the whole program)
- Lifetime is the program runtime