understanding format specifiers



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 ?
Is it true for all format specifier?
-Siliconwafer

.



Relevant Pages

  • Re: understanding format specifiers
    ... > I will get hex equivalent of 43. ... > Does the format specifier do an implicit "decimal to hex" conversion ... It does an explicit conversion from ...
    (comp.lang.c)
  • Re: understanding format specifiers
    ... and if the result cannot be accomodated in the target the results are ... > I will get hex equivalent of 43. ... > Does the format specifier do an implicit "decimal to hex" conversion ... > before displaying? ...
    (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)
  • Re: Array length
    ... It's needed because it's undefined behavior to pass printfa format specifier and a corresponding argument which do not match. ... Since, in C90, it was guaranteed that "unsigned long" was the largest integer type, conversion of a size_t value to unsigned long was the only approach that was guaranteed to produce the correct value, of a type for which there was a guaranteed known format specifier. ...
    (comp.lang.c)