Jump to content

Recommended Posts

Posted

hello,

I am in big need for an undefined array. The user shall have the option to set his array size. I allready tried this:

Dim $realArray = _myArrayCreate(200)

func _myArrayCreate($size)
    local $tmpArray[$size]
    for $i = 1 to $size
        $tmpArray[$i] = 0
    Next
    return $tmpArray
Endfunc

This just does not work for me. The problem seems to be the first line of the function (local $tmpArray[$size]). AutoIt cannot parse this line.... :)

any suggestions?

Posted

Arrays are zero-indexed. When you define an element with 200 elements, the first element is zero and the last is 199.

Start your loop at 0 instead of 1 and end it at $size-1.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...