Num1> = 0x80 - What is 0x80?

Do I see this in some code? Checks that int is greater than 0x80. What is 0x80? This is not an int.

thanks

+8
c #
source share
5 answers

This integer literal is the hexadecimal number 80, which is the decimal number 128. The prefix "0x" indicates that it is in hexadecimal format.

See section 2.4.4.2 of the C # Language Specification: Integer Literals for more details.

+30
source share

This is the hexadecimal literal for 128. In fact, it is an int. Any literal starting with 0x is a hexadecimal literal.

+7
source share

This is a hexadecimal number .

+3
source share

The prefix 0x means that it is hexadecimal, 0x80 means 128 in decimal. Similarly, 128 will mean 0x80 in hexadecimal format. So this is perfectly true:

 int x = 0x80; 
+1
source share

0x... is the hexadecimal notation for an integer

 0x80 = 128 
0
source share

All Articles