Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 561
richard Avatar asked Jan 20 '23 08:01

richard


1 Answers

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.

like image 119
Matteo Italia Avatar answered Jan 30 '23 08:01

Matteo Italia