1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help with outputting an integer

Discussion in 'Programming' started by davegibelli, Nov 21, 2007.

  1. davegibelli

    davegibelli New Member

    Joined:
    Nov 21, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    With the simple code below...

    char ptr[4]={0x00, 0x00 ,0x00, 0xff};

    printf("%u", *ptr);

    you would expect to get 255 BUT I get zero...why?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Why you are expecting 255. ptr is the address of the base location and * means value at that location and so it should be what you are getting.
     

Share This Page