Mathematics
 
 
MTH 568 - Compuational Science

 

Home
 

Syllabus
 

Course Outline
 

Resources
 

Contact Info


 
Variables and Data



C has a variety of variable types from which the programmer can choose depending on the type of data (integer, float, character, boolean, etc.) that is needed to be stored.
 

  • Types of Numerical Variables
    • int
    • float
    • double

     
  • Types of Non-Numerical Variables
    • boolean
    • char
    • FILE
     
  • Declaring and Assigning Variables
    • int x;
    • x = 5;

     
  • Arithmetic Operands
    • addition +
    • subtraction -
    • multiplication *
    • division /
    • modulo %
    • increment ++, --
    • shorthand operators +=, -=, *=, /=, %=
    • examples:
      • y = y + 2;
      • z = (x * y) / 5;
      • r = 5 % 3;