RPC/XDR struct はその C の構造体とほとんど同じように宣言されます。宣言は以下のように行われます。
struct-definition:
struct struct-ident "{"
declaration-list
"}"
declaration-list:
declaration ";"
declaration ";" declaration-list
次に、二次元の座標である XDR 構造体と、その構造体がコンパイルされて生成される C 構造体の例を示します。
struct coord { struct coord {
int x; --> int x;
int y; int y;
}; };
typedef struct coord coord;
出力は、最後に追加された typedef を除いて入力と同一です。これによって、項目を宣言する際に、struct coord の代わりに coord を使用することができます。