I. bitwise AND OPERATION OF x & y
For example, x = 3 y = 3
Then: x = y = 0011
Result 3:
X | y is a bitwise OR operation. If the value is the same as 0, the difference is 1.
II,
Int Vac = 3;
Int main (){
Int Vac = 10;
: Vac;
Count <: Vac;
Count <Vac;
Return 0;
}
Result: 4,10
III,
Int I = 3, j = 4;
I? I: j;
Result: 4 4
V,
Int I = 1, j = 2;
Int k = I j;
Result: k = 3;
VI,
X = x 1;
When reading x twice, the compiler does not consider the left and right x addresses to be the same.
X = 1;
X address system once
X;
Sort efficiency from low to high
VII,
# Define product (x) (x * x)
Int main (){
Int I = 3, j, k;
J = product (I );
// I = 5
K = product (I );
Return 0 ;}
Result: j = 9; k = 49;
8,
Int a = 5, B = 3;
! A & B;
Result: a = 5 B = 3 because when the & operation is flase, the following values are not calculated, and false is used directly.
IX,
Char foo (void)
{
Unsigned int a = 6;
Int B =-20;
Char c;
(A B> 6 )? C = 1: c = 0;
Return c;
}
Result: c = 1;
Unsigned and signed addition, the signed will be automatically converted to the unsigned type, that is, B will be converted to a large integer, so it must be greater than 6;
10,
# Define SQR (x) (x * x)
Main (){
Int a, B = 3;
A = SQR (B 2 );
}
Result: a = 11;
B 2 should be passed in.
The actual execution is B 2 * B 2;
Instead of (B 2) * (B 2)
If SQR (x) * (x), the result is 25.
XI,
Preprocessing: the number of seconds in a year. It should be caused by overflow. Therefore, pay attention to the data type.
# Define SECONDS_PRE_YEAR (60*60*24*365) UL
12,
Macro definition: MIN
# Define MIN (A, B) (A) <= (B )? (A) :( B) Pay attention to the use of parentheses.
The documents are not complete. The above are for reference.