Skip to content

How to get the address of a record variable? #84

Answered by edubart
stefanos82 asked this question in Q&A
Discussion options

You must be logged in to vote

You have printed the address of o.x there, it's 0x5574305962a0, this address is fixed, because it's inside the block of memory of the record. "record" really means a block of memory, so all variables inside a record have their addresses relative to the block of memory address. You can notice the address is also the same as the record address, this is because x is at the very start of the memory block region, so the very first field always has the same address of the record.

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@stefanos82
Comment options

Answer selected by edubart
Comment options

You must be logged in to vote
2 replies
@edubart
Comment options

@stefanos82
Comment options

Comment options

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

@codehz
Comment options

@stefanos82
Comment options

@edubart
Comment options

@stefanos82
Comment options

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