Without width printing format in C

Posted by yCalleecharan on Stack Overflow See other posts from Stack Overflow or by yCalleecharan
Published on 2010-04-06T15:27:25Z Indexed on 2010/04/06 15:33 UTC
Read the original article Hit count: 115

Filed under:
|
|

Hi, in C if I have a printf statement containing say "%.2f", it says that the precision is 2 digits after the decimal place. I haven't explicitly specify the width. I have two questions:

  1. Is this good programming practice?;

  2. Is without specifying the width means that the width of the field will get adjusted automatically when printing the number, irrespective of the number of digits it contains?

Thanks a lot...

© Stack Overflow or respective owner

Related posts about printf

Related posts about width