fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int var = 5;
  5. int * pVar = NULL;
  6.  
  7. pVar = &var;
  8.  
  9. printf ("The address is %p\n", (void *)&var);
  10. printf ("The same address (via pointer variable) is %p\n", (void *)pVar );
  11.  
  12. printf ("The value at the address is %d\n", *(&var));
  13. printf ("The value at the address (via pointer) is %d\n", *pVar );
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 4492KB
stdin
Standard input is empty
stdout
The address is 0x7fff2f06540c
The same address (via pointer variable) is 0x7fff2f06540c
The value at the address is 5
The value at the address (via pointer) is 5