Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - 2. The following data _ _ is a legal data constant specified by C language. The answer is what happened to d. ABC?
2. The following data _ _ is a legal data constant specified by C language. The answer is what happened to d. ABC?
According to the expressions of integer constants in C language, errors can be found by one-to-one correspondence.

First, two of the four answers start with 0 and two with 0x. Discuss separately.

Integer constants in C language start with 0 in octal, where a single number does not exceed 8 and the range of values is 0-7. The number of answer A ends in B, which is wrong. There is an 8 in the middle of answer C, which is beyond the range of numbers.

Integer constants in C language are based on 16 and start with 0x, where the single number does not exceed 16, that is, 0-9. G in answers A-F and B is out of the range of numbers, so it is wrong.

Answer A is confusing, but C language has no binary integer constant.

1, decimal integer constant

Integer constants in this format can only have numbers from 0 to 9, and can have positive and negative signs. For example:

0 1 364 28 -34

2. Octal integer constant

Integer constants in this format are octal numeric strings starting with the number 0. Where the numbers are 0 ~ 7. For example:

0 1 1 1 decimal 73, 0 1 1 decimal 9,0123 decimal 83,

3. Hexadecimal integer constant

Integer constants in this format are hexadecimal numeric strings starting with 0x or 0X(x is capitalized). Where each number can be 0 ~ 9, a ~ f or a ~

Numbers or English letters in F. For example:

0x 1 1 decimal 17, 0Xa5 decimal 165, 0x5a decimal 90.