Home > Casio > Personal Computer > Casio Z1 Gr User Manual

Casio Z1 Gr User Manual

Here you can view all the pages of manual Casio Z1 Gr User Manual. The Casio manuals for Personal Computer are available online for free. You can easily download all the documents as PDF.

Page 101

  101 /* 100 squares 3 */ /* #include  */  double dsquare(x) /* square */ double x; {  return (x*x); }  main(){  double d;  for (d=1.0; d

Page 102

  102  6.1 Constants and Variables 6.1.1 Local variables and global variables Local variables  A local variable is one that is declared within a function for use within that particular function only. Since such variables are local, you can use the same variable name in multiple functions without any problem – each variable is treated independently, even though they have the same name. Have a look at the program listed below.  /* Local variable */ /* #include  */  void pr() /* print function */ {  int i;...

Page 103

  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...

Page 104

  104 Finally, the printf() statement displays the value of “xy” which is the result, no matter which arithmetic operation is performed. 6.1.3 Data types and lengths The following table shows the data types and their respective lengths for the interpreter. These are almost identical on all computers, except for the integer (int) that may change.  Type declaration Interpreter char short int long float double 8-bit integer 16-bit integer 16-bit integer 32-bit integer 32-bit single precision floating point...

Page 105

  105  Code Hex Code Name Meaning ¥a ¥n ¥t ¥b ¥r ¥f ¥¥ ¥’ ¥” ¥0 ¥nnn ¥xmm 0x07 0x0A 0x09 0x08 0x0D 0x0C 0x5C 0x27 0x22 0x00  0xmm Bell (BEL) New Line (NL) Horizontal tab (HT) Backspace (BS) Carriage return (CR) Form feed Yen symbol Single quote Double quote Null Octal notation Hexadecimal notation Sound buzzer Carriage return + Line feed Horizontal tab Backspace (one character) Returns to line start Change page Character ” ¥ ” Character “ ‘ “ Character “ “ “ Equivalent to zero Character code for octal...

Page 106

  106  Floating-point constants and double precision floating-point constants  Decimal values can be defined as float type or double type constants using the format shown below. Exponents are indicated by the letter “E” or “e”. Example: 3.1416 -1.4141 1.0e-4  1.23456E5  The following shows the ranges of float and double.  float 0, ±1e-63 - ±9.99999e+63 double 0, ±1e-99 - ±9.999999999e+99  String constants  String constants are contained in double quotation marks. The structure of character strings is...

Page 107

  107 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

Page 108

  108 You can also use a pointer within a character string to isolate single characters from the string.  /* Pointer example */ /* #include  */ main(){  char *p;  p=”Casio”;  printf(“%c %s¥n”,*p,p); }  Execution of this program will produce the following result: C Casio  >_  This is because a string is actually a pointer to the first character, the “null” character (0) being added after the last character to close the string.  Now, lets assume we want to access the third letter of the string “Casio”. We...

Page 109

  109 The following table shows all of the operators used by C and their functions, explained in their order of precedence.  Primary Operators ( ), func( ) x[ ], y[ ][ ] Parenthetical, function argument operations. Specify array elements. Unary Operators *px &x -x ++x, --x x++, x-- ~x !x (type)x sizeof(x) Specifies content indicated by a pointer. Address of variable x. Negative value x. +1 / -1 before using variable x. +1 / -1 after using variable x. NOT performed on each bit (inversion). Logical NOT (if...

Page 110

  110  The following table shows the precedence of associativity of the C operators.  Precedence Operators Associativity High  ( ), [ ] → Left to right   Unary !, ~, ++, --, -, (type), *, &, sizeof ← Right to left   Multiplication, division *, /, % → Left to right   Addition, subtraction +, - → Left to right   Shift  → Left to right   Relational >, =, 
Start reading Casio Z1 Gr User Manual
All Casio manuals