Defining Functions - Casio FX-890P Owner's Manual

Casio personal computer owner's manual
Table of Contents

Advertisement

We have now the value assignment nested loop we saw before, followed by a similar
set of loops to read and display the values after they are stored. The only new item is
the "%8.2f" which specifies that each value will be displayed in an area of at least 8
characters, with two decimal places (right flush).
.R U N .
.
1 .
.
2 .
.
3 .
.

6.2.6 Defining functions

Function definition and program modules
Besides the standard functions, the C programming language lets you define your
own routines as functions to be called by later programs. We have seen a hint of this
already in the "main()" first line of our programs to define them as main functions.
Using the procedures presented here, you will ba able to break large programs down
into modules and then call up each module from the main() function. This means that
you will eventually build up your own library of functions that you can call up from
various programs as you need them.
Creating functions
The following is the format for function definition:
function type declaration
argument type declaration;
{
declaration of variables used in the function
statements...
}
Function type
This part of the function declares the type of data that will be returned by the function.
This line may be omitted if the value to be returned is an integer (int) or if there is no
data returned. But a good programming discipline is to formally declare an "int" type
or a "void" type when nothing is returned.
Function name
You cannot use reserved words as function names, and you should not use names
already used for standard function names The following is a table of reserved words.
auto
default
break
do
case
double
char
else
const
(enum)
continue
extern
The standard functions are listed on page 113
4 .
.
5 .
.
6 .
.
float
for
goto
if
int
long
7 .
.
8 .
.
9 .
.
1.00
4.00
7.00
>_
function name (arguments)
register
return
short
signed
sizeof
static
99
2.00
3.00
5.00
6.00
8.00
9.00
(struct)
(volatile)
switch
while
(typedef)
(union)
unsigned
void

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z-1grZ-1

Table of Contents