Dereferencing Array Pointers
Mahonroy
Posts: 175
in Propeller 1
Hey guys,
I have been passing array pointers like this:
And then I can dereference it like this:
So if I can do that, how come I cannot do this?
What is the proper way of assigning the pointer to a variable so I can access the index without having to use the "byte" every single time?
Thanks and any help is greatly appreciated!
I have been passing array pointers like this:
byte payload[32] nRF.TransmitPayload(@payload)
And then I can dereference it like this:
byte[payloadAddress][i]
So if I can do that, how come I cannot do this?
payload := byte[payloadAddress] payload[2] := 1
What is the proper way of assigning the pointer to a variable so I can access the index without having to use the "byte" every single time?
Thanks and any help is greatly appreciated!
Comments
You can't give a name to a variable that contains an address in Spin like you can in C. Spin doesn't have the same kind of type name declarations as C. You have to use "byte[payloadAddress][2] := 1"
There really isn't any way to get away from the byte[...] nomenclature in Spin for accessing a remote byte variable whose address is known. That's just the way it's done.
-Phil