Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language, must the operand of bitwise operation be an integer constant or a variable? Why? Can't other types of quantities be expressed in binary?
C language, must the operand of bitwise operation be an integer constant or a variable? Why? Can't other types of quantities be expressed in binary?
All the data in the computer are stored in binary. Whether it is a floating-point type or a double-precision type, it is a combination of 0 and 1 when it is actually saved, and it is binary.

C language can only use integer constants for bit operations, which is the limitation of this language and has nothing to do with computers. It is also possible if it is designed to allow other types of data to perform bit operations. Just because of the particularity of data storage mode, other types of data are not suitable for bit operation because of their lack of understandability and implementation efficiency.

You can check how the float type is stored in memory (somewhat similar to the scientific counting method), and you will understand why it is not good to perform bit operation on it.