April 19, 2024, 03:53:33 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Array usage

Started by talun, November 09, 2007, 07:41:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

talun

After goes crazy for understanding the problem for which a routine of calculation with an array furnished absurd values, I have understood that it is always necessary to initialize a static array before its use (differently from the Emergence Basic).
Just for curiosity, can anyone say me if this behaviour is typical of other languages or it is exclusive for Aurora?

thanks!

Sergio



Ionic Wind Support Team

Arrays are no different in Aurora than they are in Emergence.

If you are defining the array as a subroutine local variable then it is uninitialized since it is located on the stack.  If the array is a global variable in either language then it will be initilized to all zeros when the executable is loaded by the OS.

In either case you can initialize an array to all zeros by using a single API function.


declare import, RtlZeroMemory(dest as pointer, length as int)

def myarray[20,10] as int
RtlZeroMemory(myarray, LEN(myarray) )


Ionic Wind Support Team

talun

Ok, all is clear;  my array defintion was located in a sub.
I will use the RtlZeroMemory system.

Thank you  :D

Sergio