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.

Format specifier in scanf for bool datatype in C

I am using bool datatype in C std99 whose definitions are defined in <stdbool.h>. Now I want …

c scanf format-specifiers
Python - fixed exponent in scientific notation?

Consider the following Python snippet: for ix in [0.02, 0.2, 2, 20, 200, 2000]: iss=str(ix) + "e9" isf=float(iss) print(iss + "\t=> " + ("%04.03e" % …

python scientific-notation format-specifiers
copying a short int to a char array

I have a short integer variable called s_int that holds value = 2 unsighed short s_int = 2; I want to copy …

c++ c format-specifiers
(nil) pointer in C/C++

I am working on a project and I keep coming across this error that will not allow me to complete …

c++ c pointers printing format-specifiers
Specifying maximum printf field width for numbers (truncating if necessary)?

You can truncate strings with a printf field-width specifier: printf("%.5s", "abcdefgh"); > abcde Unfortunately it does not work for …

printf truncate format-specifiers
Format specifier for hex char in C

Is there a format specifier for sprintf in C that maps a char to hex in the same way that %…

c hex format-specifiers
warning: format ‘%x’ expects argument of type ‘unsigned int’

When I try and compile this I get the following error, not sure why... warning: format ‘%x’ expects argument of …

c printf format-specifiers
What's the meaning of the %m formatting specifier?

The output for this code printed out ‘Success’. printf("%m\n");

c printf glibc errno format-specifiers
Using various format specifiers of c in c++

As in c we can use various format specifiers like %nd where n is a number, to print the number …

c++ format-specifiers
Doesn't %[] or %[^] specifier in scanf(),sscanf() or fscanf() store the input in null-terminated character array?

Here's what the Beez C guide (LINK) tells about the %[] format specifier: It allows you to specify a set of …

c string scanf format-specifiers character-arrays