CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

printf Field Width and Precision

C code walkthrough · Question 41
mediumStrings

Code

Read carefully. What does this print?
1#include <stdio.h>
2int main() {
3 printf("%5d\n", 42);
4 printf("%-5d|\n", 42);
5 printf("%.3f", 3.14159);
6 return 0;
7}

Your answer