Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leading character on hex number (x0)

I've googled this but possibly typing in the wrong thing.

I see hexadecimal numbers knocking about such as 3A and 0x3A, but what does the leading 0x mean? I read somewhere it means the number is signed, but converting a negative decimal to hex in calc doesn't produce a hexadecimal number with the leading 0x.

Any points much appreicated.

like image 473
m.edmondson Avatar asked Nov 25 '10 09:11

m.edmondson


1 Answers

It's just a convention, used in C and C-like languages, to distinguish between different bases, e.g. 0x10 (hex) versus 10 (decimal) versus 010 (octal) versus 0b10 (binary).

like image 130
Paul R Avatar answered Oct 03 '22 17:10

Paul R