C++ data types and expressions

C++ data types:

    1. Basic type: Integer: short integer (short int) 2 bytes, long integer (long int) 4 bytes, integer (int) 4 bytes.

                        Character type (char): 1 byte.

                        Floating point type: 4 bytes for single precision (float), 8 bytes for double precision (double), and 8 bytes for long double precision (long double).

                        boolean: (bool)

    2. In front of the integer symbol int and the character symbol char, the modifier signed (when signed) or unsigned (when unsigned) can be added.

    3. When there is a sign, the data is stored in the form of complement, and the highest bit in the storage unit represents the sign of the data.


    4. Constants: (1) Integer constants: decimal integer (L or l after the constant), octal integer (the beginning of the constant is 0), hexadecimal (the beginning of the constant is 0X(x))

                  (2) Floating-point data representation: decimal fractional form (if F or f is added after the real number, it means that the number is a single-precision floating-point number, and if L or l is added after the real number, it means that the number is a long-precision floating-point number).

Exponential form (the exponent part of the digit part of the number sign).

        No matter what form the floating-point type is represented in the program, it is stored in the exponential form in memory.

              (3) Character constants: ordinary character constants (contains only one character, case-sensitive), escape character constants. Character constants are stored in the memory location with the ASCII code of the character.

            (4) String constant: The compilation system will automatically add a '\0' after the string as the end mark of the string.

    

                

Guess you like

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