EasyManua.ls Logo

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 #103 background imageLoading...
Page #103 background image
103
Here, variable “i” is declared outside of any function, so “i” will be treated as a global
variable. Consequently, it will retain its current value regardless of whether execution
is in main() or pr(). In this program, variable “i” is assigned a value by the “for” loop in
main(), and then the value of “i” is printed by function pr().
Note that any function has access to “i”, not only to read it but as well to modify it.
This increases the risk of unexpected software errors and is a major drawback of
global variables.
If you decide to use global variables, here are some basic rules to follow:
Restrict the usage to variables that make sense to be global, but cannot be
considered as a constant. Example: Screen_W, Dist_Unit.
Use long, descriptive names to make obvious the type of value that is stored.
6.1.2 Pointers and variable storage locations
Entering values
Here, we will write a calculation program that performs specific integer arithmetic
operations on values entered via the scanf() standard function. With this program,
entry of “33+21 . . “ would for example produce the result “=54”.
/* scanf example */
/* #include <stdio.h> */
main(){
char op;
int x,y,xy;
xy=0;
scanf(“%d%c%d”,&x,&op,&y);
if(op==’+’) xy=x+y;
else if(op==’-‘) xy=x-y;
else if(op==’*‘) xy=x*y;
else if(op==’/‘) xy=x/y;
else if(op==’%‘) xy=x%y;
else printf(“unknown op”);
printf(“=%d”¥n”,xy);
}
Variable “op” is a character type while “x”, “y”, and “xy” are integer type. Since we are
using the scanf() function, arguments are expressed preceded by ampersands,
becominf “&x”, “&op” and “&y”. In C, an argument such as “&x” represents the
location in memory that the contents of variable “x” are stored. It is called an address.
The scanf() function understands arguments to be addresses, and represents the
value stored at the address within the expression. See the Command Reference for
detailed information on the scanf() function.
The line “scanf’”%d%c%d”, &x, &op, &y);” accepts input of integers for variables “x”
and “y”, and a character code for variable “op”.
The execution of the next statement depends on the character assigned to variable
“op”. If it is a plus sign, the first “if” statement is executed, if it a a minus sign, the
second “if” statement is executed, etc.

Table of Contents

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

Summary

Unit Configuration

Operational Functions

Details the primary keys and their functions, including power, shift, and numeric keys.

Keyboard Layout

Describes the arrangement of keys and how to access different functions.

Power and System Features

Power Supply and Battery Replacement

Provides instructions for replacing the calculator's batteries.

Fundamental Operation Modes

CAL Mode

Describes the primary calculation mode active upon power-on.

Formula Storage Function

Explains how to store and recall mathematical formulas for repeated calculations.

Programming Modes

Introduces BASIC, C, CASL, and Assembler modes for programming.

Calculation Functions

Manual Calculation Input and Correction

Guides on entering and correcting arithmetic and function calculations.

BASIC Programming

Features of BASIC

Highlights the advantages and capabilities of the BASIC language.

BASIC Program Input

Provides steps for entering and preparing BASIC programs.

BASIC Program Execution

Details how to run BASIC programs and handle execution errors.

BASIC Variables and Commands

Variables

Explains numeric, string, and array variables in BASIC.

BASIC Command Reference

A comprehensive reference for BASIC commands and functions.

BASIC Command Reference Details

Mathematical Functions

Reference for ABS, ACS, ANGLE, COS, SIN, SQR, TAN, etc.

BASIC String and Graphical Functions

C Programming Introduction

Learning C with Pocket Computer

Guidance on using the pocket computer as a C learning tool.

Meet the Casio C Interpreter

Introduces the C interpreter and its operation compared to compilers.

C Program Input Procedures

Using the C Editor

Details on creating and editing C source code.

C Program Execution

C Programming Essentials

Variable Types and Operations

Covers C data types (char, int, float, double) and assignments.

Selection Statements

Explains the 'if' and 'if-else' statements for conditional logic.

C Control Flow and Functions

Using Loops

Details 'while', 'do-while', and 'for' loops for repetitive execution.

Defining Functions

Explains how to create and use custom functions in C.

C Constants, Variables, and Operators

Constants and Variables

Covers variable scope, types, and storage.

C Operators and Command Reference

Operators

Lists and explains C operators and their precedence.

C Command Reference

Reference for C commands like RUN, EDIT, TRON, TROFF.

C Command Reference Details

String Functions

Reference for strcat, strchr, strcmp, strcpy, strlen.

Related product manuals