Structures

The C language structures are usually located in header files in either the /usr/include or /usr/include/sys directory, but they can be located in any directory in the file system.

An XDR structure is declared almost exactly like its C language counterpart; for example:

struct-definition:
      "struct" struct-ident "{"
      declaration-list
      "}"

declaration-list:
      declaration ";"
      declaration ";" declaration-list
Compare the following XDR structure to a two-dimensional coordinate with the C structure that it is compiled into in the output header file.

struct coord {          struct coord {
      int x;      -->          int x;
      int y;                   int y;

};                      };
                        typedef struct coord coord;

Here, the output is identical to the input, except for the added typedef at the end of the output. As a result, the programmer can use coord instead of struct coord when declaring items.