TAL Programmer's Guide
TAL and C Guidelines
Mixed-Language Programming
096254 Tandem Computers Incorporated 17–23
Multidimensional Arrays
In C, you can declare multidimensional arrays. In TAL, you can emulate
multidimensional arrays by declaring structures that contain arrays.
Here is an example of multidimensional arrays in TAL and C (large-memory model):
TAL Code C Code
STRUCT rec1 (
*
);
BEGIN
INT y[0:4]; short cma[10][5];
END;
STRUCT .EXT tma(rec1)[0:9];
!Sample access! /* sample access */
tma[8].y[3] := 100; cma[8][3] = 100;
Arrays of Structures
If you specify bounds when you declare a TAL structure, you create an array of
structures. The following TAL and C arrays of structures are equivalent. Each
declaration contains an array of ten structure occurrences:
TAL Code C Code
STRUCT cell (
*
); struct cell
BEGIN {
INT x; short x;
STRING y; char y;
END; };
STRUCT .EXT tcell(cell)[0:9]; struct cell ccell [10];
PROC honey (c); void JOANIE
INT .EXT c (cell); (struct cell *);
EXTERNAL;