How to pass a physical address of a variable directly to a pointer without using & operator?

  ampersand, c++, memory-address, pointers, segmentation-fault

what I want from second_pointer is to point to the address passed directly into it, but the error is Segmentation fault (core dumped)
Why ?

 short i {} ;
  short* pointer { &i} ;
  LOG " address of variable : " << pointer ; 
  short* second_pointer = (short*) 0x7ffe8475245e ; 
  LOG " value pointed by second pointer : " << *second_pointer ; 

and this is the result :

address of variable : 0x7fff56ab3756
value pointed by second pointer : Segmentation fault (core dumped)

Source: Windows Questions C++

LEAVE A COMMENT