Help with outputting an integer

davegibelli's Avatar, Join Date: Nov 2007
Newbie Member
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?
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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.