Variable-length Array Declarations

Variable-length array declarations have no explicit syntax in C, so XDR invents its own syntax using angle brackets.

The maximum size is specified between the angle brackets. A specific size can be omitted to indicate that the array may be of any size.

variable-array-declaration:
      type-ident variable-ident "<" value ">"
      type-ident variable-ident "<" ">"
An example of a set of variable-length array declarations is:

int heights<12>;          /* at most 12 items     */
int widths<>;             /* any number of items  */
Note: The maximum size is specified between the angle brackets. The number, but not the angle brackets, may be omitted to indicate that the array can be of any size.
Because variable-length arrays have no explicit syntax in C, these declarations are actually compiled into structure definitions, signified by struct. For example, the heights declaration is compiled into the following structure:

struct {
     u_int heights_len;   /* # of items in array */
     int *heights_val;    /* # pointer to array */
} heights;