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
Содержание VT1419A Multifunction Plus
Страница 5: ...4 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 15: ...14 Contents Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 25: ...24 Chapter 1 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 173: ...Notes 172 Chapter 5 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 332: ...332 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 333: ...Appendix A 333 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 334: ...334 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 335: ...Appendix A 335 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 336: ...336 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 337: ...Appendix A 337 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 338: ...338 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 339: ...Appendix A 339 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 340: ...340 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 341: ...Appendix A 341 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 342: ...342 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 343: ...Appendix A 343 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 344: ...344 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 345: ...Appendix A 345 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 346: ...346 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 347: ...Appendix A 347 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 348: ...348 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 349: ...Appendix A 349 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 350: ...350 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 351: ...Appendix A 351 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 352: ...352 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 353: ...Appendix A 353 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 354: ...354 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 355: ...Appendix A 355 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 356: ...356 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 357: ...Appendix A 357 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 358: ...358 Appendix A Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 370: ...Notes 370 Appendix C Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...