NAME

array - array utilities

SYNOPSIS

#include <basic/string.h>
#include <basic/array.h>
#include <basic/type.h>

dimd(type, array, base, nsub, subs . . .  )
int type, base, nsub, subs . . .  ;
struct array *array;

erased(type, array, nsub)
int type, nsub;
struct array *array;

erases(type, array, nsub)
int type, nsub;
struct array *array;

short ubound(array, base, dim)
struct array *array;
int base, dim;

DESCRIPTION

Dimd allocates an array and initializes its header.  Type is the type of the array (see generic(inc)).  Array is a pointer to the array’s header (see array(inc)).  Base is the lower bound for all dimensions.  Nsub is the number of dimensions.  Subs is the list of upper bounds for each dimension, lowest order dimension first.  This function takes a variable number of arguments.  This function implements dynamic array allocation with the DIM and REDIM statements. 

Erased deallocates an array and clears its header.  For a string array, this function also deallocates space used by the array’s elements.  Erases clears the elements of an array.  For a numerical array, this function sets to zero the array’s elements.  For a string array, this function sets the string length to zero and deallocates space used by the array’s elements.  It is not an error to erase an erased array.  These functions implement the ERASE statement and dynamic array deallocation. 

Ubound returns the upper bound for dimension dim.  Dimensions are numbered starting with one.  This function implements the BASIC UBOUND function. 

SEE ALSO

array(inc), generic(inc)
dim(stmt), erase(stmt), redim(stmt), ubound(func)

DIAGNOSTICS

Dimd generates error 5 (Illegal function call) if the array is already allocated. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber