Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Whoops, found another array referencing bug

Author
Message
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 14th Oct 2002 20:59
This bit of code demonstrates the problem, the array printed out should have numbers 124 up in it, instead it gives zeros.
If you take the loop out of the function, or assign n(1) to another variable it works OK (so its easy to get round).
Nevertheless this still took me ages to track down.

dim j(10)
dim n(1)

setj()

for i = 1 to 10
print j(i)
next i

wait key

function setj()
for i = 1 to 10
n(1) = i
j(n(1)) = 123 + i
next i
endfunction

Login to post a reply

Server time is: 2024-04-19 00:49:03
Your offset time is: 2024-04-19 00:49:03