• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

Regarding Hexadecimal Address

hi experts,

I came across several programs that has a declaration in hex for example 0x000 whis I believe will be for bits manipulator and I really do not know what it means actually. I just wonder if there is any site can explain the reason they use such declaration and the purpose for doing so...

Basically, is there any reference I can  refer to when I come across this type of declarion again...

  • 2
1 Solution
Just about any C/C++ book will show the different ways you can create literals of the language.  In this case, a literal hexidecimal number is created by prepending the 0x.

Hexadecimal numbers are base 16 numbers, just like binary numbers are base 2 numbers.  A hexidecimal digit can be 0-9,A,B,C,D,E,F.  Where A=10, B=11, C=12, D=13, E=14, and F=15.

For instance hexadecimal A which equals 10 in decimal is also equivalent to 1010 in binary.  

In both C and C++, you can create decimal, octal, or hexidecimal numbers.  A decimal number such as 10, requires no prefix.  A hexadecimal number such as A, requires the 0x prefix.

Examine this code:
int i = 10;   // i gets the decimal value of 10
int i = 0xA; // i also gets the decimal value of 10

People often use hexadecimal notation as a condensed form of reading binary.  Since an A in binary is 1010, it is much easier just to read a single character, instead of 4.

See the following websites:
dekoayAuthor Commented:
Hi tdubroffs,

What does the 0x means  then ?
0x are the leading chars to tell then the number following is hexadecimal.
dekoayAuthor Commented:
hi tdubroff,
Thanks for response

Featured Post

Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now