BBS: Inland Empire Archive
Date: 05-29-92 (14:00) Number: 189
From: QUINN TYLER JACKSON Refer#: NONE
To: ALL Recvd: NO
Subj: Array Re-Allocation Prog Conf: (2) Quik_Bas
Hello.... Here is a bit of code that has possibilities for advanced
database applications and other QuickBASIC programs that require
dynamic, variable sized arrays. Have fun with it!
Quinn
___------Cut Here---------
DECLARE SUB qralloc (array$(), adjustment%)
CLS
DIM test$(2000)
test$(LBOUND(test$)) = "This is the first element"
qralloc test$(), 10
test$(UBOUND(test$)) = "This is the last."
PRINT test$(LBOUND(test$)), LBOUND(test$)
PRINT test$(UBOUND(test$)), UBOUND(test$)
END
REM $STATIC
SUB qralloc (array$(), adjustment%)
lo% = LBOUND(array$)
hi% = UBOUND(array$)
DIM new$(lo% TO hi%)
FOR count% = lo% TO hi%
new$(count%) = array$(count%)
NEXT
REDIM array$(lo% TO hi% + adjustment%)
FOR count% = lo% TO hi%
array$(count%) = new$(count%)
NEXT
END SUB
* SLMR 2.1a * RECURSION: If you want it done right, do it yourself...
--- Maximus/2 2.01wb
* Origin: The Nibble's Roost, Richmond BC Canada 604-244-8009 (1:153/918)