adress of a pointer

Hi

I want to print out the adress stored in a int pointer on the serial monitor. How can i realize that? Maybe someone can give me an example code. Thanks

void setup ()
  {
  Serial.begin (115200);

  char * foo = "hi there!";
  
  char buf [20];
  sprintf (buf, "foo = %p", foo);
  
  Serial.println (buf);
  }  // end of setup

void loop () {}

Output:

foo = 0x109

Addresses are 16-bit values, so cast them appropriately.

//Data
char c_Data = 'z';

//Pointer to data
char *c_ptr = &c_Data;

//Address of c_ptr stored as an int
uint16_t u_Addr = ( uint16_t ) c_ptr;

Serial.print( "Address: " );
Serial.println( u_Addr );