Zephir Posted March 13, 2008 Share Posted March 13, 2008 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? Link to comment Share on other sites More sharing options...
weaponx Posted March 13, 2008 Share Posted March 13, 2008 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. Link to comment Share on other sites More sharing options...
Zephir Posted March 13, 2008 Author Share Posted March 13, 2008 oh man. i feel sooo stupid should have thought of that myself ..big thanks to you weaponx Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now