ARRAY ALEN()

From Lianjapedia
Jump to: navigation, search

PURPOSE

Return the number of array elements

SYNONYM

api_array_alen()

SYNOPSIS

#include "lianja_api.h"
 
int	ARRAY_ALEN(string)
 
<input parameters>
char	*string;		/* Address of a buffer containing the name of an array	*/
 
<output parameters>
none

DESCRIPTION

The ARRAY_ALEN() function will return the number of elements in the specified array.

NOTE: array elements start at 1 and not 0 as in 'C'.

EXAMPLE

The following example returns the number of elements in the given array.

Example Lianja script:

declare value[20]
declare new_value[get_alen("value")]
return

Example 'C' function:

#include "lianja_api.h"
 
lianjaapi_array_alen ()
{
    int	numarray;
 
    if (_parinfo(1) == API_ATYPE ) {
       numarray = ARRAY_ALEN(_parc(1));
    } else {
       numarray = 0;
    }
 
    _retni(numarray);
}

SEE ALSO

_parinfa(), ALENGTH(), ISARRAY(), ARRAY_DEFINE(), ARRAY_LOOKUP(), ARRAY_UPDATE()