Current location - Health Preservation Learning Network - Healthy weight loss - What is an integer constant?
What is an integer constant?
Integer constants are integer constants, including all integers from negative numbers to zero to positive numbers.

The so-called n-system means that when n is full, it will advance one place. For example, binary representation 1, 2,3,4,5 are 1,1,100, 10 1 respectively.

Because the computer is binary, all data are stored in different combinations of 0 and 1 (the length of the storage unit is determined by the compiler used, TC is mostly 2 bytes and VC is mostly 4 bytes). All integer constants appearing in the program are also stored in corresponding binary, such as int a= 1, stored as 0000000001,that is to say, 1 * 2 0 = 1, and int b= 17 stored as 0000000.

When inputting and outputting data, you can choose different decimal data types, such as Decimal: directly as data input (for example, b = 17), and use %d output to determine the type; Octal: the input data starts with 0 (for example, b = 0 17) and the output is% o;; Hexadecimal: the input data starts with 0x (for example, b = 0x 17), and the output is% x. Different decimals correspond to different numbers, for example, b= 17 (decimal input), and the output is17 (in decimal, octal and hexadecimal order) 02 1(2*8^ 1+ 1*8^0= 17),0xf 1(f* 16^ 1+ 1* 16^0= 17)。

PS: binary is only 0,1; Octal is 0 ~ 7; Decimal system is 0 ~ 9; Hexadecimal numbers are 0~9, a~f, a= 10, b =11... f =15. .