C语言基础:输出变量的内存地址
#include <stdio.h> int main(void) { int count = 1; float salary = 40000.0; long distance = 1234567L; printf("Address of count is %x\n", &count); printf("Address of salary is %x\n", &salary); printf("Address of distance is %x\n", &distance); return 1; }
输出结果
Address of count is 6c9e3194 Address of salary is 6c9e3190 Address of distance is 6c9e3188