Arrays And Pointers - Casio FX-890P Owner's Manual

Casio personal computer owner's manual
Table of Contents

Advertisement

Note: The interpreter does not allow declaring a local "auto" variable within the code
of a function.
func(a)
double a;
{
int i,j,x;
float fx,fy;
long lx,ly;
for(i=0;i<5;i++){
...
}
}
Program A: OK

6.1.7 Arrays and pointers

Arrays
The interpreter allows use of arrays with an amount of dimensions only limited by the
memory capacity. Nevertheless tables of more than 2 or 3 dimensions are rare.
int tab_4[2][12][31][2]
Note that if you refer to the name of a table without the brackets, you will not get an
error. C will give you the address of the first element of the table.
&tab_4[0][0][0][0] is equal to tab_4
Initializing arrays
The interpreter let you initialize simple variables, but you cannot initialize arrays as
easily:
char *month[12]={"Jan","Feb","Mar", ... ,"Dec"};
which is allowed in ANSI C will generate an "illegal initialization error". Use instead:
char *month[12];
month[0]="Jan"; month[1]="Feb"; ... ; month[11]="Dec";
Pointers
The pointer is a 16-bit variable that holds the address of a variable. For example:
x = *px;
Here, the content at the address pointed to by px is assigned to variable x. Note the
following:
px = &x;
y = *px;
Here, the address of variable x is assigned to pointer px. Then, the content at the
address pointed to by px is assigned to variable y. Consequently, this is equivalent
to:
y = x;
func(a)
double a;
{
int i,j,x;
long lx,ly;
for(i=0;i<5;i++){
float fx,fy;
...
}
}
Program B: Error
107
func(a)
double a;
{
int i,j;
float fx,fy;
long lx,ly;
for(i=0;i<5;i++){
...
int x;
}
}
Program C: Error

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z-1grZ-1

Table of Contents