We all live in apartments, right ?
The size of the apartment do vary from place to place and person to person.
A large apartment can accomodate many people while , a small apartment can accomodate less.
Variables : These store the input values, these are nothing but named memory locations. The type of the variable must be declared such as , Large apartment or small apartment . Likewise , the terms used to indicate the size of variable are called data types.
Variable types are :
Char: Typically a single octet (one byte). This is an integer type
Int: The most natural size of integer for the machine
Float: A single-precision floating point value.
Double: A double-precision floating point value.
Void: Represents the absence of type.
int i, j, k;
char c, ch;
float f, salary;
You must notice the way variables are declared .
1) A Variable name consists of any combination of alphabets, digits and underscores.
2) The first character of the variable name must either be alphabet or underscore.
3) It should not start with the digit.
4) No commas and blanks are allowed in the variable name.
5) No special symbols other than underscore are allowed in the variable name.
Have a look at the program attached. If you execute it , you will understand the size of each variable type.