C언어 > printf Substitution Types

인기검색어 > 아두이노 센서 ATMEGA128

최신글 질문게시판 동영상강좌 가입하기

▼ BASIC4MCU 후원업체 신제품 정보 ▼

▲ BASIC4MCU 후원업체 신제품 정보 ▲

BASIC4MCU > C언어

C언어 | printf Substitution Types

페이지 정보

작성자 master 작성일18-02-05 23:42 조회1,814회 댓글0건

본문

 

Type field[edit]

The Type field can be any of:

CharacterDescription
%Prints a literal % character (this type doesn't accept any flags, width, precision, length fields).
diint as a signed decimal number. %d and %i are synonymous for output, but are different when used with scanf() for input (where using %i will interpret a number as hexadecimal if it's preceded by 0x, and octal if it's preceded by 0.)
uPrint decimal unsigned int.
fFdouble in normal (fixed-point) notation. f and F only differs in how the strings for an infinite number or NaN are printed (infinfinity and nan for fINFINFINITY and NAN for F).
eEdouble value in standard form ([-]d.ddd e[+/-]ddd). An E conversion uses the letter E (rather than e) to introduce the exponent. The exponent always contains at least two digits; if the value is zero, the exponent is 00. In Windows, the exponent contains three digits by default, e.g. 1.5e002, but this can be altered by Microsoft-specific _set_output_format function.
gGdouble in either normal or exponential notation, whichever is more appropriate for its magnitude. g uses lower-case letters, G uses upper-case letters. This type differs slightly from fixed-point notation in that insignificant zeroes to the right of the decimal point are not included. Also, the decimal point is not included on whole numbers.
xXunsigned int as a hexadecimal number. x uses lower-case letters and X uses upper-case.
ounsigned int in octal.
snull-terminated string.
cchar (character).
pvoid * (pointer to void) in an implementation-defined format.
aAdouble in hexadecimal notation, starting with 0x or 0Xa uses lower-case letters, A uses upper-case letters.[3][4] (C++11 iostreams have a hexfloat that works the same).
nPrint nothing, but writes the number of characters successfully written so far into an integer pointer parameter.
Java: indicates a platform neutral newline/carriage return.[5]
Note: This can be utilized in Uncontrolled format string exploits.

https://en.wikipedia.org/wiki/Printf_format_string 

 

댓글 : 0

조회수 : 1,814

등록된 댓글이 없습니다.

게시물 검색

C언어 목록

게시물 검색


Privacy Policy
MCU BASIC ⓒ 2017
PC버전