Difference between revisions of "ARRAY ALEN()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
m (Text replace - "lianjaapi.h" to "lianja_api.h")
 
Line 7: Line 7:
 
==SYNOPSIS==
 
==SYNOPSIS==
 
<code lang="c">
 
<code lang="c">
#include "lianjaapi.h"
+
#include "lianja_api.h"
  
 
int ARRAY_ALEN(string)
 
int ARRAY_ALEN(string)
Line 37: Line 37:
  
 
<code lang="c">
 
<code lang="c">
#include "lianjaapi.h"
+
#include "lianja_api.h"
  
 
lianjaapi_array_alen ()
 
lianjaapi_array_alen ()

Latest revision as of 06:44, 11 April 2013

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()