#include <stdio.h>
int allval1 = 0; // 全局变量
int allval2 = 0;
static int sallval1 = 0; // 静态全局变量
static int sallval2 = 0;
void displayAddresses() {
static int sval1 = 0; // 静态局部变量
static int sval2 = 0;
int val1 = 0; // 局部变量
int val2 = 0;
printf(" allval1: %p allval2: %p\n", (void*)&allval1
, (void*)&allval2
);
printf(" sallval1: %p sallval2: %p\n", (void*)&sallval1
, (void*)&sallval2
);
printf(" sval1: %p sval2: %p\n", (void*)&sval1
, (void*)&sval2
);
printf(" val1: %p val2: %p\n", (void*)&val1
, (void*)&val2
); }
int main() {
displayAddresses();
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgYWxsdmFsMSA9IDA7ICAgICAgICAgIC8vIOWFqOWxgOWPmOmHjwppbnQgYWxsdmFsMiA9IDA7CgpzdGF0aWMgaW50IHNhbGx2YWwxID0gMDsgIC8vIOmdmeaAgeWFqOWxgOWPmOmHjwpzdGF0aWMgaW50IHNhbGx2YWwyID0gMDsKCnZvaWQgZGlzcGxheUFkZHJlc3NlcygpIHsKICAgIHN0YXRpYyBpbnQgc3ZhbDEgPSAwOyAgICAvLyDpnZnmgIHlsYDpg6jlj5jph48KICAgIHN0YXRpYyBpbnQgc3ZhbDIgPSAwOwogICAgCiAgICBpbnQgdmFsMSA9IDA7ICAgICAgICAgICAgLy8g5bGA6YOo5Y+Y6YePCiAgICBpbnQgdmFsMiA9IDA7CgogICAgcHJpbnRmKCLlhajlsYDlj5jph4/nmoTlrZjmlL7pobrluo86XG4iKTsKICAgIHByaW50ZigiIGFsbHZhbDE6ICVwIGFsbHZhbDI6ICVwXG4iLCAodm9pZCopJmFsbHZhbDEsICh2b2lkKikmYWxsdmFsMik7CgogICAgcHJpbnRmKCLpnZnmgIHlhajlsYDlj5jph4/nmoTlrZjmlL7pobrluo86XG4iKTsKICAgIHByaW50ZigiIHNhbGx2YWwxOiAlcCBzYWxsdmFsMjogJXBcbiIsICh2b2lkKikmc2FsbHZhbDEsICh2b2lkKik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