Simple assignment
In the C language, operator = does not represent equality, but an assignment operator. This means that the left side of the symbol = is a modifiable variable name, and the right is the value assigned to the variable.
The following program statements:
i = i+1;
Mathematically, the equation is not tenable. As an assignment statement for C, it means finding the value of the assignment symbol = right variable i, plus 1 and then assigning the variable with the left name I. On the right side of the assignment operator = If there is a variable name, it is best that the variable name is already initialized.
Different compilers have different settings for the values of uninitialized variables, some are 0, some are random numbers, and some are directly error-aware.
Compound assignment
The arithmetic operator +,-,*,%,/and the assignment operator = combine to form a compound assignment operator, as follows:
+ =: Add Assignment Operator Example: i + = 1 equivalent to i = i + 1
-=: Minus assignment Operator Example: i-= 1 equivalent to i = i-1
*=: Multiply assignment Operator Example: I *= 1 equivalent to i = i * 1
%=: Example of an assignment operator: I%= 1 equivalent to i = i% 1
/=: Except assignment operator Example: I/= 1 is equivalent to i = I/1
To give a simple example:
#include <stdio.h> int main (void) { int9; // Add 1 to the value of variable a by using compound assignment // write down your code here. 1 ; printf ("A's value is%d\n", a); return 0 ; }
More learning content, just in the code bud Net Http://www.mayacoder.com/lesson/index
The result is certainly obvious:
C-Language Basic learning operator-assignment operator