1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int k=1; 5 int main() 6 { 7 int i=1; 8 char *j; 9 static int m=1; 10 char *n="hello"; 11 12 printf("栈区地址为:0x%x ",&i); 13 14 j=(char*)malloc(2); 15 free(j); 16 17 printf("堆区地址为:0x%x ",j); 18 printf("全局变量为:0x%x ",&k); 19 printf("静态变量地址为:0x%x ",&m); 20 printf("文字常量区地址为:0x%x ",n); 21 printf("程序区地址为:0x%x ",&main); 22 23 return 0; 24 }