printf
Formatted output using conversion specifiers.
Beginner
printf("%d mA, %.2f V, %s, 0x%04X\n", 20, 3.3, "ok", 255);
%d int, %u unsigned, %ld long, %f double, %c char, %s string, %p pointer, %x hex, %zu size_t. Width/precision: %8.3f. Use PRIu32 from inttypes.h for fixed-width types.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.