Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Basic data types of C language
Basic data types of C language
Short, int, long, char, float and double represent six basic data types in C language.

Integer constant:

(1) Decimal integer constant: composed of numbers 0~9. Such as: 0,10,365,-12, etc.

(2) Octal integer constant: starting from 0 and consisting of numbers 0~7. Such as: 0,010,0365, -0 12, 0 1 1 etc.

(3) Hexadecimal integer constants: starting with 0X or 0x, consisting of digits 0~9, a~z or a ~ z, such as 0x 1 1, 0Xffff, 0xa5,-0XAC, etc.

Note: C language system defaults to basic integer constants. (For "basic integer", please refer to the following)

Integer variable:

(1) is divided into signed integers and unsigned integers according to whether the most significant bit of an integer is a sign bit or not.

(2) According to the space occupied by integers in computer memory, they are divided into short integers (short int or short), basic integers (int) and long integers (long int or long).

Short x =10; Equivalent to the signed short x =10; It is also equivalent to the signed short integer x = 10.

Int age = 20 is equivalent to signed int age = 20.

Dragon z =10000l; (After adding L, it means that 10000 is a long integer constant, not a basic integer constant).

note:

(1) C language system is a signed integer by default.

(2) Unsigned and signed cannot appear at the same time.

(3) Short and long cannot appear at the same time.