How to declare hexa & octadecimals data types in c++
An int is an int is an int. Ints have several *representations* to us humans, i.e.
we sometimes prefer to talk about int values in hexadecimal, octal, decimal,
binary or tally notation. C and C++ just support octal, decimal and hexadecimal
notation for us. There are even functions available that can convert strings that
represent other int notations to an int. But all ints are just ints to a computer.
So, i, j and k all have the same value here:
-
int i= 42; // decimal
-
int j= 052; // octal
-
int k= 0x2a; // hexadecimal
-
and they all have the same int type.
kind regards,
Jos