What's a hexadecimal constant, and should I bother learning? Are there situations were I need to know it or can I always use some other way?
Printable View
What's a hexadecimal constant, and should I bother learning? Are there situations were I need to know it or can I always use some other way?
>What's a hexadecimal constant
A hexadecimal constant is the same thing as a decimal constant except using a different numbering system. For example:
int i = 27;
and
int j = 0x1B;
Are both equivalent. The only difference is what numbering system you used for the constant, if you asked for the decimal value of j then you would still get 27. Hexadecimal constants must being with 0x (zero + x) and octal constants must begin with 0 (zero).
>Are there situations were I need to know it or can I always use some other way?
Regardless of whether or not you use hexadecimal in your programs, it's good to at least know how other number systems work. The most important to programmers are binary, octal, decimal, and hexadecimal.
-Prelude