In <Xns93A5C8668263mambuhlearthlinknet@207.217.77.2 6> Martin Ambuhl <> writes:
>Christopher Culver <> wrote
>(25 Jun 2003) in news: s.com
>/ comp.lang.c:
>
>> printf("This is a hex number: %x", hexNumber)
>>
>> but this results in only the minimum number of digits being displayed,
>> i.e. "7e" instead of "0x007e". Is there anything I can use in place of
>> %x which will display the fully qualified hexadecimal number?
>
>#include <stdio.h>
>
>int main(void)
>{
> unsigned hexNumber = 0x7e;
> printf("[output]\nThis is a hex number: %#06x\n", hexNumber);
IMHO, it is more practical to use %#.4x for the job. No need to bother
counting the prefix characters.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: