diff options
| -rw-r--r-- | addressof2.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/addressof2.c b/addressof2.c new file mode 100644 index 0000000..b47855f --- /dev/null +++ b/addressof2.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +int main(int argc, const char *argv[]) +{ + int int_var = 5; + int *int_ptr; + + int_ptr = &int_var; + + printf("int_ptr = 0x%08x\n", (unsigned int)int_ptr); + printf("&int_ptr = 0x%08x\n", (unsigned int)&int_ptr); + printf("*int_ptr = 0x%08x\n", (unsigned int)*int_ptr); + + printf("int_var is locatedat 0x%08x and contains %d\n", (unsigned int)&int_var, int_var); + printf("int_ptr is located at 0x%08x, contains 0x%08x, and points to %d\n\n", (unsigned int)&int_ptr, (unsigned int)int_ptr, *int_ptr); + return 0; +} |
