Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does using STATIC give me an error?
#1
This works in QBASIC, but not in FreeBASIC for some reason.
It says duplicated definition for "dim array(47) as integer".

Code:
sub subname ()
static array() as integer, notfirst

if notFirst = 0 then
   notFirst = 1
   dim array(47) as integer
end if

end sub

Am I doing something wrong?

EDIT: Whoops, I just figured out that doing "STATIC array(47)" to dimension the variable works.
Reply
#2
redim?
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#3
maybe array's a keyword or something? I dunno... I recall something about how you have to have '$dynamic (or just DYNAMIC now) or something'll happen to variables.

I got nothing. :lol:
Jumping Jahoolipers!
Reply
#4
STATIC syntax is FB is the same as with DIM or REDIM, not like in QB where you have to declare the array twice, simple do:

static somearray(lowerbound to upperbound, ...) as sometype

lowerbound and upperbound can't be variables, only constant expressions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)