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 / dynamic arrays....

Author
Message
iaretony
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location:
Posted: 26th Jul 2003 02:14
How in the heck do you actually use the built in stack/array/list functionality?

This is not documented very well, if someone explains it to me I'd be willing to write a tutorial...

Basically, how do I create a variable sized array?
How do I add elements?

The attached code was my attempt at figuring this thing out. I expected the "print" line to print 2, but it prints 0. So I must be doing something wrong...

Thanks in advance.

Tony
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Jul 2003 02:22
Stack example



Queue example:

iaretony
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location:
Posted: 26th Jul 2003 06:17
Thanks! I got the following code to work, but their is one GLARING problem!

"array count" doesn't return the count of elements inserted, it returns the last valid index! This code clearly adds 3 elements, but "array count" returns 2. This function should be called "top index" or something... or "last valid index"... Calling it count is just evil... I hope I don't forget this!

Tony

Login to post a reply

Server time is: 2026-07-23 02:37:52
Your offset time is: 2026-07-23 02:37:52