1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| #include <stdio.h>
int global_var = 5;
int main() { static int static_var = 6; int local_var = 7; int* p = (int*)malloc(100);
printf("the global_var address is %lx\n", (unsigned long)&global_var); printf("the static_var address is %lx\n", (unsigned long)&static_var); printf("the local_var address is %lx\n", (unsigned long)&local_var); printf("the address which the p points to %lx\n", (unsigned long)p);
free(p);
sleep(1000);
return 0; }
|