Top "Printf" questions

`printf` is a common function for formatted output.

Unsigned values in C

I have the following code: #include <stdio.h> int main() { unsigned int a = -1; int b = -1; printf("%…

c printf unsigned
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
Does C have a string type?

I have recently started programming in C, coming from Java and Python. Now, in my book I have noticed that …

c string char printf strcpy
Padding characters in printf

I am writing a bash shell script to display if a process is running or not. So far, I got …

bash shell printf
Where is `%p` useful with printf?

After all, both these statements do the same thing... int a = 10; int *b = &a; printf("%p\n",b); printf("%08…

c++ c printf
Java: Literal percent sign in printf statement

I'm trying to add an actual percent sign into a printf statement in Java and I'm getting the error: lab1.…

java printf escaping
How to pass variable number of arguments to printf/sprintf

I have a class that holds an "error" function that will format some text. I want to accept a variable …

c++ c printf variadic-functions
Can I display the value of an enum with printf()?

Is there a one-liner that lets me output the current value of an enum?

c printf enums
Is there a way to specify how many characters of a string to print out using printf()?

Is there a way to specify how many characters of a string to print out (similar to decimal places in …

c++ c printf
What primitive data type is time_t?

I do not know the data type of time_t. Is it a float double or something else? Because if …

c types printf time-t