c语言运算符的详细讲解(国外英语资料)
c语言运算符的详细讲解(国外英语资料)
The assignment operator
The function of an assign statement is to assign values of a constant or variable or expression to another variable. The sign is' = '. And this is not the same thing as saying, just assigning the value, is equal to saying, "= =".
Note: the variable on the left of the assignment statement must be declared elsewhere in the program.
The variables that have to be assigned are called left values because they appear on the left side of the assignment statement; The expression that produces a value is called the right value because she appears on the right side of the assignment statement. The constant can only be a right.
Such as:
The count = 5;
Total1 total2 = = 0;
The first assignment statement is understandable.
The second assignment statement means to assign 0 to both variables. This is because the assignment statement is from right to left, which is to start at the right. So it's going to be total2 = 0; Then total1 total2 =; So can we do that?
= (total1 total2) = 0;
That's not ok, because we're going to start with the inside of the parentheses, where total1 = total2 is an expression, and the left side of the assignment statement doesn't allow the expression to exist.
Second, arithmetic operators
There are two single and five binocular operators in the C language.
Symbolic function
+ monocular is
- monocular negative
* the multiplication
/ division
% modulus
+ addition
- subtraction
Here are some examples of assignment statements that use the arithmetic operator in the right-hand side of the assignment operator:
Area = Height * Width;
Num = num1 + num2 / num3 - num4;
The operator also has an operational order problem, which is plus or minus. It's the first operation of a single order with a single one.
The fetch operator (%) is used to calculate the remainder of the two integers. Such as:
A = 7% 4;
And the result of a is 3, because the remainder of 7 is 3.
So someone asked, what do I do with their quotient?
B = 7/4.
So b is