Skip to content

Pointer and address memory of x value #233

Closed Locked Answered by DayDun
survuvi asked this question in Q&A
Discussion options

You must be logged in to vote

address_of is a static method and is not meant to be called on an instance, only on the type itself.

If you want to print the address you probably want to write

var x : Int = 42
let xPtr = Pointer[Int].address_of(x)
print(xPtr.__as_index())
print(xPtr.load())
94602671945872
42

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@Moosems
Comment options

@abhinav-upadhyay
Comment options

@survuvi
Comment options

@abhinav-upadhyay
Comment options

@survuvi
Comment options

Answer selected by survuvi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants