Operator study notes in C language

A: Discrimination of confusing concepts
B: XOR summary
C: Shift summary

Section A:

Shift operator for binary, integer (floating point can't do it), don't try to move negative numbers, this is not defined by the standard

Modulo operations are performed on integers

The register variable has no address, so the address cannot be taken

Division plus decimal point is the starting point of floating-point numbers. For example, 1.0/n is the division of floating-point numbers.

Section B:

(1). XOR with 1 will flip

(2). XOR with 0 remains unchanged

(3). A number XOR itself is equal to 0

(4). The result of each bit is only related to that bit.

Section C:

Arithmetic shift: shift right, discard the left side, complement the sign bit with 0 for positive numbers and 1 for negative numbers

Logical shift: right shift discards left complement is 0

Right shift is equivalent to dividing by 2: eg: int mid = left-(left-right)>>1;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325860707&siteId=291194637