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


  Operator for comparison   

  1. Value operator such as ..clause 1..:
  2. ..clause 2..: Relational operator
  3. ..clause 3..: Boolean

Value operator such as [1]

The operator in this system is called an equal value operator though it introduced the == operator in the foregoing paragraph.
The following two kinds are prepared in the value operator.
Sign It truly becomes it. It becomes an imitation.
== Two values are equal. Two values are not equal.
!= Two values are not equal. Two values are equal.
It is used whether these operators are equal or not so the value for the sake of comparison.
Judge The input number : the following program 10.

 
#include <stdio.h> 

int main(void)  
{
	int suuti;  
	scanf("%d",&suuti);  
	If (suuti == 10) Printf ("The input value :  10 \n");  
	If (Suuti =   10) Printf ("The input value :  10 \n");  
	return 0;
}
This..program..execute..have..input..result..as follows..become.

10   Input data
The input value,
It has ..the execution of this program.. and the result becomes as follows about .....

135   Input data
The input value 10. Then, it is not.

  ][ Because of   operator it
This relative operator and the relation and the boolean explains next are operators.
In a word, it is possible to use it to calculate by usually putting it in the expression.
The following expression is a variable With val1 Val2 :.
When it is equal It is 1 in answer (In a lot of compilers).
When it is not equal 0 is substituted.

answer = val1 == val2;
It is not possible to recommend to you and to do though the senior has the person who likes such way.

It returns to contents.


[2] Relational operator

The value operator : whether two values are equal though it was an examined operator.
The relational operator is an operator that examines the magnitude correlation of two values.
Sign It truly becomes it. It becomes an imitation.
< Left values are smaller than the right. Left values are not smaller than the right.
> Left values are larger than the right. Left values are not larger than the right.
<= A left value is below the right. A left value is not below the right.
>= A left value is more than the right. A left value is not more than the right.
When it is small, the following differences : though it might be now a thing needless to say.
The value is contained or it is a difference whether contain it. Return the truth more than the future when it is equal.

These operators are used to examine the magnitude correlation of two values.
The input number : the following program Judge be larger than ten.

 
#include <stdio.h> 

int main(void)  
{
	int suuti;  
	scanf("%d",&suuti);  
	If (suuti == 10) Printf ("The input value :  10 \n");  If (Suuti >   10) Printf ("The input value : More greatly than ten.  \n". );  If (Suuti <   10) Printf ("The input value : It is smaller than ten.  \n". );  return 0;
}
This..program..execute..have..input..result..as follows..become.

10   Input data
The input value,
It has ..the execution of this program.. and the result when a large input is done becomes as follows from .....

135   Input data
The input value It is larger than ten.
It has ..the execution of this program.. and the result when a small input is done becomes as follows from .....

5   Input data
The input value It is smaller than ten.

It returns to contents.


[3] Boolean

The boolean : in an operator different for a moment from a current operator.
Two or more conditions are integrated, and it is used to reverse the judgment.
Sign Meaning It truly becomes it. It becomes an imitation.
&& And,(AND) The truth both of right, left conditions Either of a right, left conditions is imitations even by one.
|| Or,(OR) Either of a right, left conditions is the truth even by one. Imitation both of right, left conditions
! No. (NOT) The condition is an imitation. The condition is the truth.
Only though it is possible to judge on one condition a degree in the if sentence
The judgment on two or more conditions becomes possible by using these operators.
The input number : the following program Judge it is between 8-12.

 
#include <stdio.h> 

int main(void)  
{
	int suuti;  
	scanf("%d",&suuti);  
	If (Suuti > =   8 & suuti < =   12) Printf ("It is between 8-12.  \n");  If ((suuti > =   8 & suuti < =   12)) Printf ("It is not between 8-12.  \n");  return 0;
}
The result when this program is executed and it inputs between 8-12 becomes as follows.

9   Input data
It is between 8-12.
The result when this program is executed and it inputs between 8-12 becomes as follows.

3   Input data
It is not between 8-12.
The point of this program is in the part of the condition of the if sentence.
In the usual process only because it is possible to judge on one condition in the if sentence
8 or more The condition of 12 or less cannot be judged.
However, the judgment on two conditions becomes possible by using & operator.

Moreover, the judgment of the second if sentence will judge ..one.. eyes. The operator was only added.
Because it is an operator that has it, the operator : the function of reversing the judgment result.
It completely becomes an opposite outcome with if sentences of one of eyes.

It returns to contents.


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