c - Memory allocation of variable -
suppose don't have os , write c , compile program run on computer without os. program has line int = 0; question variable stored , how program determine store variable?
it depends on , how declared it.
if it's global variable, or static variable declared inside function, linker decides put (typically in .data or .bss section, initialized or uninitialized data, respectively). executable loader (or, if don't have os under it, bootloader) decide in ram goes.
if it's local variable, compiler put on call stack or in register.
Comments
Post a Comment