About self-operated operators and binary operators

xiaoxiao2021-03-05  58

1. Self-operator arithmetic rules: before the variable, first computational, then value; Such as: int a = 2, b; b = a; // equivalent to: {a = a 1; b = a;} b = a ; // equivalent to: {b = a; a = a a;

2, binary operator calculation rules: First seek the value of the expression of both sides of the number, and then the result of the two end values. Such as: int a = 2, b = 3, c; c = a b; // corresponds to: {2 3; c = 5} C = (a a) (A B); // quite At: {2 2, 2 3, 4 5, C = 9}

3, and mixed application calculation rules: operator priority is higher than operator. Such as: int A, m; m = ( a) ( a) ( a); / / result is m = 13 m = ( a) ( a) ( ) a) ( a); / / The result is m = 19 to explain the following: m = ( a) ( a) ( a); equivalent to: m = (( A) ( a)) ( a); pressing from left to right, two numbers, first seek two numbers to be added, according to this principle: m = (4 4) ( a) // a = 4 = 8 ( a) // a = 4 = 8 5 // a = 5 = 13 Similarly: m = ( a) ( a) ( a) ( a); equivalent to: m = (( a) ( a)) ( a)) ( a); // a = 2 m = ((4 4) ( a)) ( a) // a = 4 = (8 5) ( a) // a = 5 = 13 6 // a = 6 = 19

转载请注明原文地址:https://www.9cbs.com/read-31872.html

New Post(0)