C examples for Reference:Language Reference
C.S. | Input Data and Supported Types |
---|---|
%c | character. The default width of input field is 1. White space characters are also treated as data by this conversion specification. Types: char. |
%d | decimal integer. Types: short int, int, signed int, signed short int, unsigned short int. |
%hd | decimal integer. Types: short int, signed short int, unsigned short int. |
%ld | decimal integer. Types: long int, signed long int. |
%i | integer. The integer may be octal (leading 0) or hexadecimal (leading 0x or 0X). Types: short int, int, signed int, signed short int, unsigned short int. |
%li | integer. The integer may be octal (leading 0) or hexadecimal (leading 0x or 0X). Types: long int, signed long int. |
%o | octal integer, with or without leading zero. Types: unsigned short int, unsigned int. |
%lo | octal integer, with or without leading zero. Types: unsigned long int. |
%u | unsigned decimal integer. Types: unsigned int. |
%lu | decimal integer. Types: unsigned long int. |
%x | hexadecimal integer, with or without leading 0x or 0X. unsigned short int, unsigned int. |
%lx | hexadecimal integer, with or without leading 0x or 0X. unsigned long int. |
%s | string of non-white space characters which is not delimited by double quotes. |
%f | floating-point number. Accepts number in standard form. Types: float. |
%e | floating-point number. Accepts number in exponent form. Types: float. |
%g | floating-point number. Accepts number in exponent form. Types: float. |
%lf | floating-point number. Accepts number in standard form. Types: double. |
%le | floating-point number. Accepts number in exponent form. Types: double. |
%lg | floating-point number. Accepts number in exponent form. Types: double. |
%Lf | floating-point number. Accepts number in standard form. Types: long double. |
%Le | floating-point number. Accepts number in exponent form. Types: long double. |
%Lg | floating-point number. Accepts number in exponent form. Types: long double. |
%p | pointer value as printed by printf("%p"); |
%n | writes into the argument the number of characters read so far by this call. |
%[...] | matches the longest non-empty string of input characters from the set between square brackets. |
%[^...] | matches the longest non-empty string of input characters not from the set between square brackets. |