Pointer issue [solved]

Just starting out? Need help? Post your questions and find answers here.
kingwolf71
Posts: 30
Joined: Wed May 01, 2019 10:14 am

Pointer issue [solved]

Post by kingwolf71 »

I am mostly a PB user and I use Spiderbasic due to its similarity
but this code doesn't work on Spiderbasic even though it runs

Code: Select all


Procedure   Test(*var.integer)
   *var\i = 7
   
EndProcedure


a.i = 5
Test(@a)
debug a

On PB the result is 7 while on SpiderBasic it is 5.
can someone explain please?

EDIT after @Fred pointer-ed me in the right direction

Code: Select all

Structure stFlag
   i.i
EndStructure


Procedure   Test(*var.stFlag)
   *var\i = 7
EndProcedure


a.stFlag\i = 5
Test(@a)
Debug a\i

Last edited by kingwolf71 on Sat May 25, 2024 2:34 pm, edited 1 time in total.
Fred
Site Admin
Posts: 1820
Joined: Mon Feb 24, 2014 10:51 am

Re: Pointer issue

Post by Fred »

In spiderbasic, you need to use the structure as well for your variable, native type can't be aliased like it's done on PureBasic
Post Reply