※スタイルシート未対応ブラウザではレイアウトを正確に再現できません。
  > | advanced by | contents  | that returns in <    
                   < [modosusu] > Color magazine monochrome light and shade   font predetermined, Gothic Ming-style type longhand   size Konaka large   standard  


  Kind of variable   

  1. ..clause 1..: Data type
  2. ..clause 2..: Variable that memorizes real number

[1] Data type

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.
Though int that memorized the integer was used in the foregoing paragraph
In this type, many kinds of the other exists.

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.


[   Data type   ]
Kind of of numerical valueThe size and the form of presentation are different.
In C language, the name is given separately those each kinds.
There is what is called what what type well the name and.

It returns to contents.


[2] Variable that memorizes real number

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 variable that had been used ahead was int type.
The kind of variable of another one and double (double) types can be used besides it.
The double type is a type that memorizes the real number while the int type memorizes the integer.

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.

 
#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;
}
The execution result of this program becomes as follows.

13.000000
7.000000
30.000000
3.333333
It is understood that the usage is quite the same if it compares it to the program ahead.

It returns to contents.


< - It is advanced -> | in | head that returns  to returning  next |.