Re: understanding format specifiers




"siliconwafer" <spdandavate@xxxxxxxxx> wrote in message
news:1125405314.541569.279450@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi All,
> What does a 'format specifier' do?
> Suppose I do,
> int a = 43; //decimal number
> printf("%x",a);
> I will get hex equivalent of 43.
> Does the format specifier do an implicit "decimal to hex" conversion
> before displaying ?

No. It does an explicit (stated with "%x") conversion from
binary to hex.

> Is it true for all format specifier?

Yes, all format specifiers cause a conversion from binary
to text.

-Mike


.



Relevant Pages

  • understanding format specifiers
    ... I will get hex equivalent of 43. ... Does the format specifier do an implicit "decimal to hex" conversion ... before displaying? ...
    (comp.lang.c)
  • Re: understanding format specifiers
    ... I will get hex equivalent of 43. ... Does the format specifier do an implicit "decimal to hex" conversion before displaying? ... int main{ ...
    (comp.lang.c)
  • Re: understanding format specifiers
    ... >I will get hex equivalent of 43. ... >Does the format specifier do an implicit "decimal to hex" conversion ... All format specifiers tell printf what format to use, ... CLC FAQ ...
    (comp.lang.c)
  • Re: Anyone object to the following change in libc?
    ... according to the format specifier, if that match is not empty it converts ... the value to the corresponding type and, if assignment suppression was ... thrown away because assignment is suppressed. ... the macro EOF if an input failure occurs before any conversion. ...
    (freebsd-current)
  • Re: Array length
    ... was no format specifier specifically for size_t, ... potentially be any unsigned integer type. ... Since, in C90, it was ... guaranteed that "unsigned long" was the largest integer type, conversion ...
    (comp.lang.c)