C examples for Language Basics:scanf
To input a memory address, use the %p format specifier.
scanf() with %p can read an address in the format defined by the CPU.
For example, this program inputs an address and then displays what is at that memory address:
#include <stdio.h> int main(void) { char *p;//from www. ja v a2s .co m printf("Enter an address: "); scanf("%p", &p); printf("Value at location %p is %c\n", p, *p); return 0; }