first, the basic Operation1. Arithmetic Operators
A. + addition operator
B.-Subtraction operator
C. * Multiplication operator
D./division operator //Divide two integers, the result is an integer.
E.% take-out operator (modulo operation) //NOTE: 1. % is an integer 2 on both sides. The positive and negative results of the residual result are only related to the value on the left of%.
Expand the knowledge point:
(1) Automatic type conversion
(2) Forced type conversion
(3) Automatic type promotion
1 //Code Demo:2 34 //divide two integers5int a =7/3;//The result is: 26 7 //% the positive and negative results of the residual result are only related to the value on the left of%8 intb =-7%3;//The result is:-19 intc =7%3;//The result is: 1Ten One //Automatic type conversion (Double->int) A intA =10.8; - - //coercion type conversion (Double->int) the intB = (int)10.5; - - //Automatic type lift (int->double) - Doublec =10.6+6;
2. Relational operators
A. < less operator
B. > Greater than operator
C. <= less than equals operator
D. >= greater than equals operator
E. = = equals operator
F.! = does not equal operator
Note:(1) The result of the relational operation is "true"(for example, 7>=3), return 1 , or "false"(e.g. 7<3), return 0 .
(2) in C , there is no Boolean type, and any value other than 0 is true, and only 0 is false.
//Code Demo: intA =Ten; //Judging by the results of the relational operation if(Ten= = a)//Write not recommended: a = = 0;{printf ("conditions established"); } Else{printf ("conditions are not tenable"); }
"C Language-Learning Summary" 01-operator