richard
richard

Reputation: 12498

What is this encoding? 0x21

I am reading about ASCII and the book said that ! was represented as 0x21.

Now I know that ! is the binary 00100001 in the ASCII table, which is also 33 in decimal, which converted to hex is 21. But what is this 0x part of the encoding 0x21?

Upvotes: 5

Views: 17581

Answers (1)

Matteo Italia
Matteo Italia

Reputation: 126777

0x is the prefix used for hexadecimal numbers in almost every C-like programming language, so it has become the de-facto standard when writing hex numbers.

Sometimes you may also find hexadecimal numbers denoted by the h suffix (many assembly dialects follow this convention), or (in BASIC dialects) by the &H prefix.

Upvotes: 11

Related Questions