The answer should be a compile-time assignment.
Verification process:
Write a C-language program as follows:
#include "stdio.h"
int main () {
static int i;
static int j=0x12345678;
printf ("%02x", ih[t]);
return 0;
}
Compile with GCC to generate the target file: Gcc-c test_static.c-o TEST_STATIC.O
The static variable is positioned the same as the global variable. If it is an initialized static variable, it is stored in the. Data segment, and if it is uninitialized, it is stored in the. BSS segment.
Use Objdump to view the generated target files.
Objdump-t TEST_STATIC.O
You can see the symbol and segment information in the destination file.
Objdump-j. Data-s TEST_STATIC.O
The following information is displayed:
Attached: Common objdump commands:
Objdump-t obj file name: The symbol table for the output destination file
Objdump-h obj file name: summary of all segments of the output destination file
Objdump-j. text/.data-s obj file name: Output information for the specified segment
When is a variable of static type in C language assigned value?