c语言入门教程c语言中的运算符(C language tutorial C language operator)
c语言入门教程c语言中的运算符(C language tutorial C language operator)
The operator in C language as the basic part, used in programming every hour and moment: for example, no longer need to use the variable assignment assignment operators, two the number of operations needed and compare the size of the operator, the related knowledge of this chapter "C language tutorial" will take you to the learning operator.
I. C language tutorial, assignment operator
The function of an assignment statement is to assign the value of a constant or variable or expression to another variable. The symbol is' ='. Here is not equal to the mean, just equal to the assignment, '= =' represents.
Note: the variables to the left of the assignment statement must be declared elsewhere.
We have assigned variables as an lvalue, because they appear on the left side of an assignment statement; value expressions we called rvalue, because she they appear in the assignment of the right. Only constant as an rvalue.
Such as:
Count=5;
Total1=total2=0;
The first assignment statement is understandable to everyone.
The second assignment statement means assigning 0 to two variables at the same time. This is because the assignment statement is calculated from right to left, that is to say, from the right end. So it's total2=0 first; then total1=total2; then, can we do this?
(total1=total2) =0;
This is not possible, because the parentheses are first computed, then total1=total2 is an expression, and the left side of the assignment statement is not allowed to exist.
Two, C language introductory tutorial, arithmetic operators
In the C language, there are two monocular and five binocular operators.
Symbolic function
Single eye right
Monocular negative
* multiplication
Divide
% modulo
Addition
Subtraction
Here are some examples of assignment statements that use the arithmetic operators above in the expression to the right of the assignment operator:
Area=Height*Width;
Num=num1+num2/num3-num4;
The operator also has a problem fo