1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* printf example */ #include <stdio.h> int main() { printf("Characters: %c %c \n", 'a', 65); printf("Decimals: %d %ld\n", 1977, 650000L); printf("Preceding with blanks: %10d \n", 1977); printf("Preceding with zeros: %010d \n", 1977); printf("Some different radixes: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100); printf("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416); printf("Width trick: %*d \n", 5, 10); printf("%s \n", "A string"); return 0; }
You can clone a snippet to your computer for local editing. Learn more.