Next: Dynamic control of Up: Finer control of Previous: Finer control of

Field widths

Output formats convert to default field widths but you can vary this. Between the % and the conversion character, you may also use:

minus sign: means left justify within the field (instead of right);

a minimum field width: if necessary the output is space-padded;

a full stop followed by a precision (number of digits in the decimal fraction or the maximum number of characters etc);

l: for long (see earlier).

Examples

   printf("%f", pi);  /* the value of pi is printed */

   printf("%10f", pi);  /* here it will occupy at least 10 places */

   printf("%10.3f", pi);  /* At least 10 places, 3 after the dec. point */



Next: Dynamic control of Up: Finer control of Previous: Finer control of


maspjw@
Tue Sep 27 15:29:34 BST 1994