2.3.1
Integral type Constants
Integer constants and integer constants. It can be a decimal, octal, hexadecimal numeric integer value. The decimal constants are in the form of:
D i g i t s
S
Here d i g i t s can be one or more decimal digits from 0 to 9, the first digit cannot be 0. The octal constants are in the form of:
0 d i g i t s
S
Here, d i g i t s can be one or more octal (between 0~7), and starting 0 is a necessary guide.
The hexadecimal constant is the following form:
0 x H D i g i t s0 x H D i g i t s
Here h d i g I t s can be one or more hexadecimal numbers (from 0~9 numbers, and from "a" ~ "F" letters).
The guide 0 is required, and the X-letter is available in uppercase or lowercase. Note that whitespace characters do not appear between integer digits. Table 2-3 lists the form of an integer constant.
The integer constant is always positive when not specifically stated. If a negative value is required, the minus sign "-" must be placed before the constant expression.
Each constant is given a type according to its value. When an integer constant is applied to an expression, or when there is a minus sign, the constant type automatically performs the appropriate conversion, and the decimal constant can be equivalent to a signed integer or a long integer, depending on the size of the desired constant.
Octal and hexadecimal constants can correspond to integers, unsigned integers, long integers, or unsigned long integers, depending on the size of the constant. If a constant is available as an integral type, an integer is used. An unsigned integer is used if the constant value is greater than the maximum value that an integral type can represent, but is less than the maximum number of integer digits. Similarly, if a constant is greater than the value represented by an unsigned integer, it is a long integral type. If you want to, of course, you can also use unsigned long integer type.
A constant followed by a letter L or L, is considered to be a long integral type. such as 1 0 L, 7 9 L, 0 1 2 L, 0 5 L, 0 x A L, 0 x 4 f L.
2.3.2 Integral type variable
As mentioned earlier, C stipulates that all variables used in a program must specify their type in the program, or "define". This is different from B a S I C and F O RT R A N and is similar to p a s c a l.
The results of the operation are:
R U N <enter>
A+u=22, B+u=-1 4
You can see that different types of integer data can be used for arithmetic operations. In this example, I N-t type data and unsingned int data are added and reduced.