Learning Focus:
- Arithmetic operators
- An arithmetic expression
Learning content:
The C-language operators can be divided into the following categories:
1. Arithmetic operators: Used for various numerical operations. Including plus (+), minus (-), multiply (*), except (/), balance (or modulo operation,%), self-increment (+ +), self-reduction (--) a total of seven.
2. Relational operators: Used for comparison operations. Includes more than (>), less than (<), equals (= =), greater than or equal (>=), less than Equals (<=), and not equal to (! =) Six.
3. Logical operators: for logical operations. Included with (&&), or (| |), non-(!) Three kinds.
4. Bitwise operator: The amount of the involved operation, calculated according to bits. There are six kinds of bits and (&), bit or (|), bit non (~), bit xor (^), left (<<), right Shift (>>).
5. Assignment operator: For assignment operation, divided into simple assignment (=), compound arithmetic Assignment (+=,-=,*=,/=,%=) and compound bit operation Assignment (&=,|=,^=,>>=,<<=) Three class total 11 kinds.
6. Conditional operator: This is a three-mesh operator for conditional evaluation (?:).
7. Comma operator: Used to combine several expressions into an expression (,).
8. Pointer operator: used to fetch content (*) and Fetch address (&) Two kinds of operations.
9. The number of bytes operator: the number of bytes (sizeof) used to calculate the data type.
10. Special operators: Parentheses (), subscript [], member (→,.) and several others.
Precedence and binding issues for operators
The precedence is higher than the low priority of the operation, C language precedence and binding is the same as in mathematics, but the assignment needs to be noted, such as "X=y=z", the assignment operator is the right combination, first execute "y=z", and then Execute "x= (y=z)".
05-c language Operators