This does the same thing right?

BlitzMax Forums/BlitzMax Programming/This does the same thing right?

Function Test(t:float[])
End Function

Function Test(t:float ptr)
End Function


So its safe to assume either implementation is correct?

*One step close to understaning pointers* - I've always used em in C++, but never understood what they were.

the label for a float array is actually a float ptr behind the scenes so it should be ok

Within the second function you could do
Print t[0] to print the first float from the array

I could also use Print t[0] in the first Function too right?

So the correct definition for an array is something like: "A pointer to the first element"?

arrays are treated as objects in Bmax and have a length field, so it's not truly "the same thing" although, the indexing methods are the same (as AngelDaniel mentioned.)

Strict

Global blah:Float[] = New Float[25]
blah[1] = 53235

Function test(obj:Object)
Print Float[](obj)[1] 'the cast is necessary because you can't index an object
EndFunction

test(blah)


Traditionally an array is just a pointer to the first element, correct. Of course, there is some "behind the scenes stuff too", the compiler stores the size of the array somewhere ( array.length in Bmax).

Ahh ok, more understandable now. Thanks guys.

So its safe to assume either implementation is correct?
No. One is managed (the array) and the other is not (the pointer).