Specifications

Program Structure and Syntax
In this section, the portion of the ‘C’ programming language that is directly
applicable to the VT1419A’ Algorithm Language will be learned. To do this, the
‘C’ Algorithm Language elements will be compared with equivalent BASIC
language elements.
Declaring Variables In BASIC, the DIM statement is typically used to name variables and allocate space
in memory for them. In the Algorithm Language, the variable type and a list of
variables is specified:
BASIC ‘C’
DIM a, var, array(3) static float a, var, array[ 3 ];
Here, three variables are declared. Two simple variables, a and var, and a single
dimensioned array, array.
Comments
·
Note that the ‘C’ language statement must be terminated with the semicolon
;”.
·
Although in the Algorithm Language all variables are of type float, they
must be explicitly declared as such.
· All variables in an algorithm are static. This means that each time the
algorithm is executed, the variables “remember” their values from the
previous execution. The static modifier must appear in the declaration.
·
Array variables must have a single dimension. The array dimension
specifies the number of elements. The lower bound is always zero (0) in the
Algorithm Language. Therefore the variable array from above has three
elements; array [0] through array[2].
Assigning Values BASIC and ‘C’ are the same in this aspect. In both languages, the symbol “=” is
used to assign a value to a simple variable or an element of an array. The value can
come from a constant, another variable, or an expression. Examples:
a = 12.345;
a = My_var;
a = My_array[ 2 ];
a = (My_array[1]+6.2) / My_var;
The Algorithm Language and Environment
Program Structure and Syntax
Chapter 4 133
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com