Post Reply 
HP-71B Dynamic array allocation
03-01-2024, 06:16 PM
Post: #12
RE: HP-71B Dynamic array allocation
(02-27-2024 07:59 AM)J-F Garnier Wrote:  The array allocation on the 71B is indeed dynamic, that is you can increase/decrease the size of the array with memory taken from/released to the free memory pool.

In other HP BASIC implementations, such as the 75C, Series 80 or RMB, the array is allocated only once (sometimes in the "pre-run" phase) with the DIM statement and constant (static) dimensions, i.e. DIM A(10,10) not N= 10 @ DIM A(N,N).
In these implementations, the REDIM statement can be used to change the array dimensions within the limits of the DIM memory allocation, and the elements are then preserved, with a significant difference versus the 71B:

HP-71B                     HP-75C
10 OPTION BASE 1           10 OPTION BASE 1
20 DIM A(3,3)              20 DIM A(3,3)
30 MAT A=(1)               30 MAT A=(1)
40 DIM A(2,2)              40 REDIM A(2,2)
50 DIM A(3,3)              50 REDIM A(3,3) 
60 MAT PRINT A;            60 MAT PRINT A;

1 1 1                      1 1 1
1 0 0                      1 1 1
0 0 0                      1 1 1

J-F
(from a hypothetical future "Lectures on HP BASIC" :-)

Thanks for clarifying the difference on how to implement dynamic arrays between the 71B and the 75C.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-71B Dynamic array allocation - Namir - 02-26-2024, 11:53 AM
RE: HP-71B Dynamic array allocation - Uli - 02-26-2024, 10:02 PM
RE: HP-71B Dynamic array allocation - Namir - 03-01-2024 06:16 PM



User(s) browsing this thread: 1 Guest(s)