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 printf format specifier for size_t: %zu or %Iu?

I want to print out the value of a size_t variable using printf in C++ using Microsoft Visual Studio 2010 (…

c++ c visual-studio-2010 printf format-specifiers
What's the difference between %ul and %lu C format specifiers?

In an example of "C Primer Plus", the author has used %ul format specifier (in both scanf and printf) for …

c format-specifiers
What does `scanf("%*[^\n]%*c")` mean?

I want to make a loop in C that, when the program asks for an integer and the user types …

c user-input scanf format-specifiers
How do I printf() a uint16_t?

I need to use printf() to print a uint16_t. This SO answer (How to print uint32_t and uint16_…

c format-specifiers uint16
Read no more than size of string with scanf()

Edit: for my class I have to use scanf. So recommending other ways of input is not the solution I …

c string scanf format-specifiers
Platform independent size_t Format specifiers in c?

I want to print out a variable of type size_t in C but it appears that size_t is …

c platform-independent size-t format-string format-specifiers
What does the %*s format specifier mean?

In some code that I have to maintain, I have seen a format specifier %*s . Can anybody tell me what …

c printf format-specifiers
sprintf for unsigned _int64

I am having following code. output of second %d in sprintf is always shown as zero. I think i am …

c++ c format-specifiers uint64 long-long
What is the purpose of the h and hh modifiers for printf?

Aside from %hn and %hhn (where the h or hh specifies the size of the pointed-to object), what is the …

c printf variadic-functions promotions format-specifiers
error: aggregate value used where an integer was expected

I am having following union union data { uint64_t val; struct{ .... } }; and I have a function func(union data mydata[]) { …

c linux printf unions format-specifiers