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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly