Re: understanding format specifiers



On 30 Aug 2005 05:35:14 -0700, in comp.lang.c , "siliconwafer"
<spdandavate@xxxxxxxxx> wrote:

>Hi All,
>What does a 'format specifier' do?

tells printf how to format the output......

>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

No, it simply prints it using hex format. Bear in mind that its
exceptionally unlikely that 43 was stored in decimal in the first
place!
>Is it true for all format specifier?

All format specifiers tell printf what format to use, yes....
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.



Relevant Pages

  • Re: printf
    ... The format specifier for printf ... Only on a severely broken compiler. ... CLC FAQ ...
    (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 ... It does an explicit conversion from ...
    (comp.lang.c)
  • Re: One word to the right extreme and another to the left extreme
    ... any of the format specifier in printf:- ... If you want to know about printf formats and you are using ... It's a lousy non-portable suggestion relying on third-party ... He has not been posting here continuously. ...
    (comp.lang.c)
  • Re: One word to the right extreme and another to the left extreme
    ... any of the format specifier in printf:- ... If you want to know about printf formats and you are using ... Cluttering the C newsgroup with a question about C? ...
    (comp.lang.c)