Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

num1 >= 0x80 - What is 0x80?

Tags:

c#

i see this in some code? Checks an int is greater then 0x80. What is 0x80? Is not an int.

Thanks

like image 332
DayTwo Avatar asked Feb 10 '11 16:02

DayTwo


3 Answers

It is an integer literal - it's the hex number 80, which is decimal 128. The "0x" prefix indicates it being in hex.

For more details, look at the section 2.4.4.2 of the C# language specification: "Integer literals".

like image 141
Jon Skeet Avatar answered Oct 09 '22 10:10

Jon Skeet


That is the hexadecimal literal for 128. It actually is an int. Any literal that starts with 0x is a hexadecimal literal.

like image 37
recursive Avatar answered Oct 09 '22 09:10

recursive


It's a hexadecimal number.

like image 26
duffymo Avatar answered Oct 09 '22 11:10

duffymo