A wide range of operators is supported in the TC development tool, which also requires that you understand the operator's knowledge, otherwise the error does not know the problem. The precedence of operators and the meanings of individual operators
Note: Precedence represents the order of operations for operators in the same expression, from high to low! Operation from left to right at the same level
are ranked from highest to lowest.
Priority level |
Operator |
Name or meaning |
Use form and description |
1 |
[ ] |
Array subscript |
array name [constant expression] |
( ) |
Parentheses |
(expression)/function name (formal parameter list) |
2 |
- |
Minus sign operator |
-Expression -10+20 |
++ |
Self-increment operator |
Variable name + +, variable name = variable name +1 (+ + + variable name not supported in 5.0 syntax) |
-- |
Self-decrement operator |
Variable name--, is variable name = variable name-1 (the + + variable name is not supported in 5.0 syntax) |
! |
Logical non-operator |
! An expression |
3 |
/ |
Except |
An expression/expression |
* |
By |
Expression-expression * |
% |
Remainder (modulo) |
Integer expression% integer expression,% must be an integral value on both sides |
4 |
& |
String connector |
Expressions & Expressions |
+ |
Add |
An expression + an expression |
- |
Reducing |
Expression-expression |
5 |
> |
Greater than |
Expressions > expressions |
>= |
Greater than or equal |
Expression->= expression |
< |
Less than |
Expressions < expressions |
<= |
Less than or equal |
Expression-<= expression |
6 |
== |
Equals |
Expression-= = Expression |
!= |
Not equal to |
Expression! = Expression |
7 |
&& |
Logic and |
Expressions && Expressions |
8 |
|| |
Logical OR |
An expression | | An expression |
9 |
= |
Assignment operators |
variable = expression |
10 |
, |
Comma operator |
An expression, an expression, |
Logic and operator Explanation (&&):
When multiple expressions are "&&" (Logical AND), the total expression is false as long as one expression is false , and the result of the total expression is true only if all the expressions are true:
Logical OR operator explanation (| |) :
When multiple expressions are "| |" When a (logical OR) operation is true, the result of the total expression is true, and the total expression is false only if all the expressions are false. such as:
Logical non-operator detailed (!) :
When multiple expressions are "!" (logical non-) operation, take the true/False value opposite to the expression result. If the original is false, then the logic is not true later, if the original is true, then the logic is not later false:
Subtraction, operator rules
Integer + integer = whole | Whole + float = Float | float + whole = float
integer-Whole = Whole | Whole-float = Float | float-whole = float
Whole * whole = whole | Whole * float = float | float * whole = float
Whole/whole = whole | Whole/float = Float | float/whole = float
Since the precedence of the floating-point type in the most basic rule is higher than the integral type, when the integer and floating-point types are computed, the resulting result will be floating point, and Integer and integer operations will result in the integer type
Lesson four, T language operators (version 5.0)