EasyManuals Logo
Home>Casio>Desktop>FX-890P

Casio FX-890P User Manual

Casio FX-890P
126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #101 background imageLoading...
Page #101 background image
101
/* 100 squares 3 */
/* #include <stdio.h> */
double dsquare(x) /* square */
double x;
{
return (x*x);
}
main(){
double d;
for (d=1.0; d<=100.0; d+=1.0)
printf(“(%lf)^2=%f¥n”,i,dsquare(d));
getchar(); /* waits ret key */
}
Variables are now declared as double precision floating-point. Variables declaration
has to happen before using them in a statement.
Note that we have to start the program with the function, in order to allow calling it
further down.
EXAMPLE 3:
The alternative method is to use declare the function first, so that the interpreter
knows its type, before actually writing the function. Here is an example using function
declaration
/* 100 squares 4 */
/* #include <stdio.h> */
extern double dsquare();
main(){
double d;
for (d=1.0; d<=100.0; d+=1.0)
printf(“(%lf)^2=%f¥n”,i,dsquare(d));
getchar(); /* waits ret key */
}
double dsquare(x) /* square */
double x;
{
return (x*x);
}
Note that a function declaration of line 3 does not specify the amount and type of
parameters. ANSI C authorizes function prototyping, which would look like:
extern double dsquare(double)
Nevertheless, prototyping is not implemented in the C interpreter of the unit. It is
therefore recommended to write functions before calling them, avoiding parameter
errors that can be hard to debug.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Casio FX-890P and is the answer not in the manual?

Casio FX-890P Specifications

General IconGeneral
BrandCasio
ModelFX-890P
CategoryDesktop
LanguageEnglish

Related product manuals