Hi, I´ve got a doubt about arrays.
How I can put vaiables in a bidimensional array, in one dimension I make something like this
dim myArray[5]
myArray[5].xpos=300
for 2 dimensional array, I stay frozen here
dim myArray[5][3]=300
myArray[5]???=??? ???
I don´t kwon the sintaxis for more of one dimension Array, for put in a value for every dimension.
Thanks for your time and help.
Best regards mentalthink
DIM data[100][100]
data[x][y] = z // no space between ] and [ !!
HI, kitty thanks!!!
But the trouble is what I want put a variable for x and another for y
DIM data[100][100]
data
- [y] = z // no space between ] and [ !!
in your example, if I don´t stay wrong the value is put to x and y, but my doubt is what I want to put 2 values, one for x and another for y.
Perhaps this can´t be done, I´m not programmer and my programming kwnledges are very little.
Thanks Kitty, again.
array
- [y] makes a two-dimensional array, see it as a spreadsheet with lots of boxes, each box can be addressed with an X and a Y coordinate or column and row if you want.
(column, row)
(0,0) (1,0) (2,0)
(0,1) (1,1) (2,1)
...
mentalthink,
Make sure you dont overstack your arrays.
if you declare DIM array[10]
then the bounds range is [0..1..2....8..9]
so this would overstack:
array[10]=12345
and this would be your last slot, and no overstack:
array[9]=12345
an overstack causes crash.
You can put X and Y like this:
TYPE MyArray
x
y
ENDTYPE
GLOBAL MyCoolArray[] AS MyArray
REDIM MyCoolArray[10][10]
MyCoolArray[1][3].x = 123
MyCoolArray[1][3].y = 321
and so on...
HI, Moru, Hemlos and Schranz0r, thanks for your explanations, it´s are very good for me, to continue growing my littles knowledges about programming..
Thanks again for your time, and answers.
Best Regards, Iván J.