GLBasic forum

Main forum => GLBasic - en => Topic started by: sf-in-sf on 2012-Nov-16

Title: Set up an array as a static variable?
Post by: sf-in-sf on 2012-Nov-16
How is it possible?   :'( Inside a function, a static variable has useful properties but how can DIM or DIMDATA be used only once to define the array size -typical for static variables-, when they must be located inside the function? Is it possible to locate them outside the function, and be called only once so the values of the array remain STATIC? Or must all arrays be only GLOBAL or LOCAL?

One more array trouble: when i pause the program to debug, only the 1st element var[0] shows a realistic value in the debug window. Did i miss an update?

Thanks everyone!
Title: Re: Set up an array as a static variable?
Post by: MrTAToad on 2012-Nov-18
You cant have static arrays as they need (or are) created each call to the function, even if they are defined as STATIC, although it could be a bug...

You may have missed an updated well