Storage location of static variables, automatic variables (local variables), global variables, and constants

Types of significance Definition method System storage location Scope of use note
Static Variable The system statically allocates the program before the program is executed (that is, the allocation is not changed at runtime) Variables declared with staic storage class No initial value assigned is stored in the .bss section, and initial value assigned is stored in the .data section Both inside and outside the function The value will be memorized
Global variable Variables defined externally Defined externally (extern can be added or not) No initial value assigned is stored in the .bss section, and initial value assigned is stored in the ro.data section Outside the function, you can use extern to modify The number of functions can be used internally and externally
Automatic variable (local variable) Local scope variable Variables defined in the function default to auto declaration Stack area Available inside the function -
constant Unchanged amount const, define modification const-modified global variables and define definitions send constants in the constant area (ro.data section); const-modified local variables are in the stack area - Value cannot be modified

const, static variable storage location

D:\OMOstepthree\holiday promotion\test

Guess you like

Origin blog.csdn.net/m0_49036370/article/details/114003682