The declaration and the usage of the variable in the foregoing paragraph though it explained
It hardly explained the type when declaring a variable.
To declare a variable in the foregoing paragraph, it explained the following writing was used.
Type name variable identifier;The type name is an example of showing the kind of the numerical value to be memorized.
In C language, a variety of kinds of numerical values can be treated.
And, it is necessary to memorize it by using a separate kind of variable of the each numerical value.
A variety of kinds of numerical values might be called a data type in this manner.
In C language, the name is given separately those each kinds.
[ Data type ]
Kind of of numerical valueThe size and the form of presentation are different.
There are not too a lot of kinds of the data type used by C language.
There is no problem as long as the following two between now are remembered.
| Type name | Kind of numerical value |
| int | Integer |
| double | Real number |
The usage is quite the same. only different the kind of the memorized numerical value this two
The following program is an example of doing the arithmetic operation by using the double type.
The execution result of this program becomes as follows.#include <stdio.h> int main(void) { double left,right; left = 10; right = 3; printf("%f\n",left + right); printf("%f\n",left - right); printf("%f\n",left * right); printf("%f\n",left / right); return 0; }
It is understood that the usage is quite the same if it compares it to the program ahead.
13.000000
7.000000
30.000000
3.333333