Thursday, February 26, 2009

Data Types of Variables
As stated in the previous post, variables also must have a specific data type associated with it. And only values with the same data type can be stored into the variable. These data type are standards set by the IEEE, Institute for Electrical and Electronics Engineers.

there are 4 basic data types:
  • int
int, short for integer stores numbers that do not contain any decimal number. This data type is used to store whole numbers.
Example : 123
  • float
float , as its name suggests, stores floating-point numbers, which are number that contain decimal number or exponents
Example:12.3
  • double
double, as its name suggests, stores a double precision floating-point number. In these documentations, we will use double rather than float.
Example:3.141592654
  • char
char, short for character, stored a single letter uppercase and lowercase accepted into the variable.
Example: 'A', 'e'

If more than 1 characters are wished be stored into a variable, we call them as character arrays, or strings. This will be discussed later on.

No comments: