CJCoding With Joseph
← Back to Question List
C Code Walkthrough #41

printf Field Width and Precision

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