HP C Programmer's Guide (92434-90009)

58 Chapter3
Calling Other Languages
Comparing Structured Data Type Declarations
Comparing Structured Data Type Declarations
This section shows how to declare a nested structure in HP C, HP Pascal, and HP
FORTRAN 77.
HP C Nested Structure
struct x {
char y [3];
short z;
char w [5];
};
struct q {
char n;
struct x v [2];
double u;
char t;
}a;
struct u{
union {
int x;
char y[4];
} uval;
};
HP Pascal Nested Structure
TYPE
x = RECORD
y : PACKED ARRAY [1 .. 3] OF CHAR;
z : SHORTINT;
w : PACKED ARRAY [1 .. 5] OF CHAR;
END;
q = RECORD
n : CHAR;
v : PACKED ARRAY [1 .. 2] OF x;
u : LONGREAL;
t : CHAR;
END;
u = RECORD
CASE
Boolean OF
TRUE : (x : INTEGER);
FALSE: (y : ARRAY[1..4] of CHAR);
END;
VAR a:q;
HP FORTRAN 77 Nested Structure
program main