TAL Programmer's Guide

6 Using Simple Variables
096254 Tandem Computers Incorporated 6–1
A simple variable is a single-element data item of a specified data type. You use
simple variables to store data that can change during program execution.
This section describes:
Declaring simple variables
Initializing simple variables
Allocating storage for simple variables
Assigning data to simple variables
Using simple variables, discussed by data type
Declaring
Simple Variables
Before you access a simple variable, you must declare it. Declaring a variable
associates an identifier with a memory address and informs the compiler how much
memory storage to allocate for the variable.
You declare a simple variable by specifying a data type and an identifier, using the type
and identifier formats described in Section 5, “Using Expressions.” For example, you
can declare a simple variable named NUM of data type INT as follows:
INT num;
You can declare more than one variable in the same declaration. In this format,
separate the variables with commas:
INT num1,
num2,
num3;
Simple variables are always directly addressed.
Specifying Data Types When you declare a simple variable, you can specify any of the following data types.
The data type determines the storage unit the compiler allocates for each simple
variable:
Data Type Storage Unit
STRING Word
INT Word
INT(32) or REAL Doubleword
REAL(64) or FIXED Quadrupleword
UNSIGNED(n) Bit sequence of specified width
“Simple Variables by Data Types” in this section gives more information on specific
data types.