PDA

View Full Version : array and memory...



Oscar Ugolini
19-09-2012, 23:46
hi all, and sorry for this question,
but i must pass an array of points to an external function ... glunurbscurve ...,
and same function in "codeblocks" is good, and not in ThinBasic...
Before i check all memory characters of my array, i would know if someone can tell me
what is the difference in memory sequence for this lines???

dim Array1(3,3) as single
dim Array(9) as single

thanks all :)

ErosOlmi
20-09-2012, 00:00
Hi Oscar,

technically they the same from memory point of view: 9 singles equal (9 * sizeof(single)) bytes.

Instead from interpretation point of view, 2D arrays in thinBasic are column major order: http://en.wikipedia.org/wiki/Row-major_order#Column-major_order

Maybe this can make the difference.

Petr Schreiber
20-09-2012, 09:34
ThinBASIC allows to modify the assignment order using the [], please see the difference here:


Uses "Console"

Dim myArray1(3, 3) As Single = [1, 2, 3,
4, 5, 6,
7, 8, 9]

Dim myArray2(3, 3) As Single = 1, 2, 3,
4, 5, 6,
7, 8, 9

PrintL "myArray1"
PrintL Join$(myArray1, ",", $CRLF)
PrintL

PrintL "myArray2"
PrintL Join$(myArray2, ",", $CRLF)
PrintL

PrintL "Press any key to quit..."
WaitKey



Petr