Running out of variable s

 BBS: Inland Empire Archive
Date: 06-06-92 (21:11)             Number: 143
From: MATT HART                    Refer#: NONE
  To: ERIC KJELLMAN                 Recvd: NO  
Subj: Running out of variable s      Conf: (2) Quik_Bas
 EK> can use in a programs... I keep running out of variable space...
 EK> (I use an incredible amount of variables... ya know?) I know
 EK> about the CLEAR statement, but is there anything else? Cause
 EK> otherwise I'm stuck at around 20000 single precision variables...
 EK> (which isn't enough for the program I'm writing, unfortunately...
 EK> I need about 50000)

As long as you have memory available, you can use single precision arrays up
to available memory.  However, they MUST be DYNAMIC far
heap arrays, and you cannot have more than 32768 elements
per array (0 TO 32767), which would make 128K in a single
array.  To make them DYNAMIC, put the '$DYNAMIC metacommand
at the top of your program, OR put the array dimension size
into a variable.  Either way, you must use REDIM rather
than DIM.

     REDIM Array1!(0 TO 32767)          ' 256K in two
     REDIM Array2!(0 TO 32767)          ' statements!

Then you must compile you program with the /AH switch (none of this stuff
works from QB - you must use a word processor or a
programmer's editor (I use Brief - very good) and compile
from the command line).

C:\>bc /ah program;
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET