Uninitialized static variable are always allocated in BSS. While .bss section is static as memory is allocated at compile time. As per many books "only variables that are initialized to a nonzero value occupy space" in executable. After program is loaded into memory, uninitialized static variables are still .bss.
**What happens when a function initializes it? ** Will it get moved to some other area?
the rest of the quote:
"In the executable file, only variables that are initialized to a nonzero value occupy space."
I.E. when the executable file is loaded into memory, the needed space is allocated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With