Get the address of an array

The other posts above tell you how to get the address, but the address won't be predictable like you're expecting.

Also, the compiler may notice that your statics are ZSTs, and therefore not assign them real memory. It could decide that any reference/pointer to them will be 0x01[1] and that would be a perfectly valid optimization for the compiler[2].

Besides, what do you actually want to do? I talked to you about the XY problem before, and I'll put my response from last time into this context:

  • You want to do X (unknown to anyone except you, because you didn't tell anyone)
  • You think you can get to X by doing Y (something with the addresses of start and end)
  • You don't know how to do Y, but URLO explains it.
  • Y clearly is not going to do anything useful, so that gets repeatedly brought up (quinedot even mentions the XY problem).

Please explain what this is supposed to do. What is your X here? What are the addresses of start and end supposed to help you do?


  1. references must not be null, and the reference and the pointer must be equal ↩︎

  2. even if it wouldn't do it in practice ↩︎

4 Likes