Top "Format-specifiers" questions

format-specifiers refer to the syntax of the format string parameter of the *printf functions in C/C++, allowing special formatting of arguments.

Correct format specifier for double in printf

What is the correct format specifier for double in printf? Is it %f or is it %lf? I believe it's %…

c floating-point printf double format-specifiers
How do you format an unsigned long long int using printf?

#include <stdio.h> int main() { unsigned long long int num = 285212672; //FYI: fits in 29 bits int normalInt = 5; printf("My …

c syntax printf format-specifiers long-long
How to printf "unsigned long" in C?

I can never understand how to print unsigned long datatype in C. Suppose unsigned_foo is an unsigned long, then …

c printf long-integer unsigned format-specifiers
How should I print types like off_t and size_t?

I'm trying to print types like off_t and size_t. What is the correct placeholder for printf() that is …

c portability format-specifiers
Format specifier %02x

I have a simple program : #include <stdio.h> int main() { long i = 16843009; printf ("%02x \n" ,i); } I am …

c printf format-specifiers
%p Format specifier in c

How are the specifiers %p and %Fp working in the following code? void main() { int i=85; printf("%p %Fp",i,…

c format-specifiers
What does "%.*s" mean in printf?

I got a code snippet in which there is a printf("%.*s\n") what does the %.*s mean?

c printf format-specifiers
How to print 1 byte with printf?

I know that when using %x with printf() we are printing 4 bytes (an int in hexadecimal) from the stack. But …

c printf format-specifiers
Why is the format specifier for uint8_t and uint16_t the same (%u)?

I only found pretty unrelated questions due to the tons of results searching for printf(). Why does uint8_t not …

c printf format-specifiers