I'm playing around with pointers and found a weird case where my code compiles in both scenario, but it seems to be impossible to reference an array position through a variable.
Can someone explain to me why this code works:
Public Status_Log(9) As String * 255
Function update(ptr As Long)
!ptr(2) = "Hey"
EndFunction
'Main Program
BeginProg
Scan (1,Sec,0,0)
update(@Status_Log)
NextScan
EndProg
But this code doesn't:
Public Status_Log(9) As String * 255
Function update(ptr As Long)
Dim i As Long
i = 2
!ptr(i) = "Hey"
EndFunction
'Main Program
BeginProg
Scan (1,Sec,0,0)
update(@Status_Log)
NextScan
EndProg
I would really appreciate any light shed on this - thank you!