Structures

Using the primitive routines, the programmer can write unique XDR routines to describe arbitrary data structures such as elements of arrays, arms of unions, or objects pointed to from other structures.

The structures themselves may contain arrays of arbitrary elements or pointers to other structures.

Structures are declared as follows:

struct {
    component-declaration-A;
    component-declaration-B;
    ...
} identifier;

In a structure, the components are encoded in the order of their declaration in the structure. Each component size is a multiple of four bytes, although the components may have different sizes. See the Structure figure (Figure 1).

Figure 1. Structure
This diagram shows a line of components side by side as follows: component A, component B, and dots signifying a continuing sequence.