GLBasic forum

Main forum => GLBasic - en => Topic started by: bigsofty on 2008-Jan-21

Title: TYPE question for Gernot...
Post by: bigsofty on 2008-Jan-21
Code (glbasic) Select
TYPE at
 a
 b[0][0]
ENDTYPE

GLOBAL c AS at

REDIM c.b[10][10]
Is this an OK way to store a 2 dimensional array variable name in a type? The reason I ask, is that if I use a 1 dimensional array I would use the code...
Code (glbasic) Select
TYPE at
 a
 b[]
ENDTYPE
Notice the lack of '0', but if I try...

Code (glbasic) Select
TYPE at
 a
 b[][]
ENDTYPE
I get a syntax error.

I don't mind using the
Title: TYPE question for Gernot...
Post by: Kitty Hello on 2008-Jan-22
If you want it pre-sized, use:
Code (glbasic) Select
TYPE Ttyp
array[5][6]

ENDTYPE
Otherwise just array[].
You can DIM any array with any dimensions (up tp 4).
Like:

Code (glbasic) Select
LOCAL a[]
DIM a[5]
DIM a[13][12]
Title: TYPE question for Gernot...
Post by: bigsofty on 2008-Jan-22
So for a 2 dimensional array that is not DIMed yet I just put in ...
Code (glbasic) Select
TYPE at
 b[]
ENDTYPE

GLOBAL c AS at

REDIM c.b[10][10]
...Just tried this, it seems to work fine.