[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
[]
Elements of an array can be identified using subscript expressions.
Consider the following 3-dimensional array defined in the "C" language.
Example:
char *ProcessorType[2][4][2] =
{ { { "Intel 8086", "Intel 8088" },
{ "Intel 80186", "Intel 80188" },
{ "Intel 80286", "unknown" },
{ "Intel 80386", "unknown" } },
{ { "NEC V30", "NEC V20" },
{ "unknown", "unknown" },
{ "unknown", "unknown" },
{ "unknown", "unknown" } } };
This array can be viewed as two layers of rectangular matrices of 4 rows
by 2 columns. The array elements are all pointers to string values.
By using a subscript expression, specific slices of an array can be
displayed. To see only the values of the first layer, the following
expression can be issued.
Example:
processortype[0]
To see only the first row of the first layer, the following expression
can be issued.
Example:
processortype[0][0]
To see the second row of the first layer, the following command can be
issued.
Example:
processortype[0][1]
To see the value of a specific entry in a matrix, all the indices can be
specified.
Example:
processortype[0][0][0]
processortype[0][0][1]
processortype[0][1][0]
()
The function call operators appear to the right of a symbol name and
identify a function call in an expression. The parentheses can contain
arguments.
Example:
ClearScreen()
PosCursor( 10, 20 )
Line( 15, 1, 30, '-', '+', '-' )
.
The "." operator indicates field selection in a structure. In the
following example, tyme2 is a structure and tm_year is a field in the
structure.
Example:
tyme2.tm_year
->
The "->" operator indicates field selection when using a pointer to a
structure. In the following example, tyme is the pointer and tm_year is
a field in the structure to which it points.
Example:
tyme->tm_year
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson