There are two ways to represent hexadecimal numbers in C language: prefix form (prefixed with 0x, followed by a hexadecimal number) and suffix form (add U after the hexadecimal number) suffix). Hexadecimal numbers use 0 to F (uppercase and lowercase letters represent the same value), the 0x prefix is required in the prefix form, and the U suffix is optional in the postfix form.
How to represent hexadecimal numbers in C language
In C language, you can use the following two There are three ways to represent hexadecimal numbers:
Method 1: The prefix form
0x
, followed by hexadecimal System numbers. 0x123
represents the hexadecimal number 291. Method 2: Suffix form
U
suffix after the hexadecimal number. 123U
also represents the hexadecimal number 291. Notes:
0
to F
(or 0
to f
) to represent. 0xABC
and 0xabc
are the same. 0x
prefix is required, otherwise the number will be interpreted as a decimal number. U
suffix is optional but recommended to improve readability. The above is the detailed content of 10How to express in c language. For more information, please follow other related articles on the PHP Chinese website!