Where to get the value of 0xd?

This is a discussion on Where to get the value of 0xd? within the C Programming forums, part of the General Programming Boards category; I am not familiar with equivalent of address (I dont know if that is the correct term), such as 0xd, ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    30

    Smile Where to get the value of 0xd?

    I am not familiar with equivalent of address (I dont know if that is the correct term), such as 0xd, 0x10, 0x0B, 0x3f, 0xcf, 0xf3, 0xfc etc... I am studying with Hard Programming in C but this terms really confused me... What are these address? and How can I convert it to digits? Please enlighten me.. Thanks.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Read up on hexadecimal (this may be better). The Windows calculator will convert them to decimal, just input the digits in "hex" mode (the 0x is a prefix to mark a number as hexadecimal and should not be inputted) and then switch to "dec" mode. So will Google. However, you will need to be familiar with hexadecimal so try doing some manually.
    Last edited by anonytmouse; 08-25-2006 at 02:15 AM.

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    30
    Thanks, i got it... thank you...

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    30
    I am just confused about the prefix... so the important "0xd" is the "d"... I am just confused why there is a "0x"... anyway, this is a great help...

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    What do you mean? Are you confused as to the meaning of "0x__" numbers? They are hexadecimals. Integers are normally handled in base 10, using the digits 0-9. Hex uses 0-9 and a-f and counts in base 16. I'm sure a quick google will learn you everything you need.

    EDIT: Darn, beaten.


    The "0x" is there to tell the computer that "10" is actually equal to 16 in decimal, and should not be interpreted as "10" in the conventional base-10 way. You don't want to know the history behind the "0x", I can tell you...
    Last edited by jafet; 08-25-2006 at 02:28 AM.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  6. #6
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I am just confused about the prefix... so the important "0xd" is the "d"... I am just confused why there is a "0x"...
    Consider the number '10'. Is it a decimal number with the value ten, or a hexadecimal number with the value 16? We need to know which so the C language provides a prefix which will identify a number as hexadecimal.

  7. #7
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    if you're talking about addresses, you would have to do something like:

    Code:
    unsigned long ValueAtAddress = (*(volatile unsigned long *)0x0000000D);
    But you have to be sure that your program has access to the address you are trying to read, or you will get nasty exceptions.
    "There are three kinds of people in the world...
    Those that can count and those that can't."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is 0xD??
    By Hunter2 in forum C++ Programming
    Replies: 2
    Last Post: 08-23-2002, 01:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21