[ create a new paste ] login | about

Link: http://codepad.org/oq1vZUl6    [ raw code | output | fork | 1 comment ]

joshua_cheek - C, pasted on Nov 15:
1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>

int main()
{
  int a = 3;
  float b = 6.412355;
  printf("%.*f\n",a,b);
  printf("%*s %*s\n" , 5 , "1" , 5 , "22");

  return 0;
}


Output:
1
2
6.412
    1    22


Create a new paste based on this one


Comments:
posted by joshua_cheek on Nov 15
The format string values can themselves be dynamic.
reply