CodePudding user response:
Don't superstitious books, examination questions, teachers, reply;CPU to superstitions, compiler, debugger, run results,
And please combine "the blind man touched the sun" and "boat out to sea must carry only a compass," try to understand,
Any theory, authority, according to legend, the truth, and the standard, explain, imagination, knowledge... Is not in my eyes!
//c + + Operators
//Operators specify an evaluation to be performed on one of the following:
//One operand (unary operator)
//Two operands (binary operator)
//Three operands (ternary operator)
//The C + + language includes all C operators and adds several new operators.
//Table 1.1 lists the operators available in Microsoft c + +.
//Operators follow a strict precedence which defines the evaluation order of
//expressions containing these operators. The operators associate with either the
//expression on their left or the expression on their right. This is called
//"associativity." Operators in the same group have equal precedence and are
//evaluated left to right in an expression unless explicitly forced by a pair of
//parentheses, ().
//Table 1.1 shows the precedence and associativity of c + + operators
//(from highest to lowest precedence).
//
//Table 1.1 c + + Operator Precedence and Associativity
//The highest precedence level is at The top of The table.
//+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +
//| Operator | Name or a fancy | Associativity |
//+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +
//| : : | Scope resolution | None |
//| : : | Global | None |
//| | [] Array subscript | Left to right |
//| | () Function call | Left to right |
//| | () Conversion | None |
//| | Member selection (object) | Left to right |
//| - & gt; | | Member selection (pointer) Left to right |
//| + + | Postfix increment | None |
//| -- - | Postfix decrement | None |
//| new | the Allocate object | None |
//| delete | Deallocate object | None |
//| delete [] | Deallocate object | None |
//| + + | Prefix increment | None |
//| -- - | the Prefix decrement | None |
//| | * Dereference | None |
//| & amp; | Address - | None |
//| | + Unary plus | None |
//| - | Arithmetic negation (unary) | None |
//|! | Logical NOT | None |
//| - | Bitwise complement | None |
//| sizeof | the Size of the object | None |
//| sizeof () | the Size of the type | None |
//| typeid () | type name | None |
//| | (type) type cast (conversion) | Right to left |
//| const_cast | Type cast (conversion) | None |
//| dynamic_cast | Type cast (conversion) | None |
//| reinterpret_cast | Type cast (conversion) | None |
//| static_cast | Type cast (conversion) | None |
//|. * | Apply pointer to a class member (objects) | Left to right |
//| - & gt; * | Dereference pointer to a class member | Left to right |
//| | * Multiplication | Left to right |
//| | Division | Left to right |
//| | % the Remainder (modulus) | Left to right |
//| | + Addition | Left to right |
//| - | Subtraction | Left to right |
//| & lt; <| | Left shift | Left to right
//| & gt;> | | Right shift | Left to Right
//| & lt; | | Less than | Left to right
//| & gt; | | Greater than | Left to right
//| & lt;=| Less than or equal to | Left to right |
//| & gt; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull