0

Does anyone knows why people using 0x before number?

For example:

mov ah, 0x16

mov ah, 16

There is a difference between them?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    `0x` is hexadecimal (base 16). Without the `0x` you get decimal (base 10). This syntax has nothing to do with it being a `mov` instruction. – lurker Feb 21 '18 at 15:06
  • It is a C syntax thing that has migrated into other languages. Not sure if it actually started with C or if C got it from prior languages (B? other?) – old_timer Feb 21 '18 at 16:20
  • https://stackoverflow.com/questions/2670639 indicates it started with C not BCPL nor B. – old_timer Feb 21 '18 at 16:24
  • 1
    Possible duplicate of [What do numbers using 0x notation mean?](https://stackoverflow.com/questions/8186965/what-do-numbers-using-0x-notation-mean) – phuclv Feb 21 '18 at 16:31

1 Answers1

7

0x implies it's a hex literal, 0x16 is 22 decimal.

Colin
  • 3,394
  • 1
  • 21
  • 29