Understanding Pointers Completely!
Posted: Sat Feb 11, 2023 4:45 am
I have a few questions on pointers as I'm trying to learn them bit by bit.
To do so while simultaneously solving a little problem I encounter now and then I started a little learning project:
"Use pointers to store variables as variants"
I'm also planning to create a linked list type of object, it will use a hash table filled with pointers to the actual values stored in memory (build upon a previous post).
I don't really get how structures are valid pointer types tho? What does a structure look like in memory behind the scenes?
Many thanks for any help!
To do so while simultaneously solving a little problem I encounter now and then I started a little learning project:
"Use pointers to store variables as variants"
Code: Select all
; var = 10 (vbscript syntax used as example)
*variant = AllocateMemory(8)
PokeI(*variant, 10)
Debug PeekI(*variant)
; now set var to string: var = "test"
*variant = ReAllocateMemory(*variant, 4) ; why does less work and should i include the string terminator character in the count?
PokeS(*variant, "test")
Debug PeekS(*variant)I don't really get how structures are valid pointer types tho? What does a structure look like in memory behind the scenes?
Many thanks for any help!