본문 바로가기

C/Reference

[C] 서식 변환 문자열

반응형

https://learn.microsoft.com/ko-kr/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-170

 

형식 사양 구문: 'printf' 및 'wprintf' 함수

Microsoft C 런타임 'printf' 및 'wprintf' 함수의 형식 지정자 구문을 설명합니다.

learn.microsoft.com

 

https://msdn.microsoft.com/ko-kr/library/56e442dc.aspx

 

Format Specification Syntax: `printf` and `wprintf` Functions

Describes the format specifier syntax for the Microsoft C runtime `printf` and `wprintf` functions

learn.microsoft.com

 

https://msdn.microsoft.com/ko-kr/library/hf4y5e3w.aspx

 

printf Type Field Characters

printf Type Field Characters Article 06/05/2017 In this article --> The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com. The latest version of this topic can be found at Visual Studio 2017 Documentation. I

learn.microsoft.com

 

출력 형식
설명
%d
10진수 정수형으로 출력합니다.
%o (%#o)
8진수 정수형으로 출력합니다.
%x (%#x)
16진수 정수형으로 출력합니다.
%X
16진수 정수형 대문자로 출력합니다.
%p
16진수 정수형으로 출력, 4byte 모두 출력
값이 입력되지 않은 앞 부분은 0으로 채워짐
%u
부호없는 10진수 정수형으로 출력합니다.
%c
한 문자를 출력합니다.
%s
문자열을 출력합니다.
%f
부동소수점으로 12.345와 같이 출력합니다.
%e
부동소수점으로 1.2345E12와 같은 형식으로 출력합니다.
%E
%e와 같되 대문자로 출력
%g
%e나 %f 중에서 출력할 자릿수를 덜 차지하는 형태로 출력합니다.
%G
%g와 같되 대문자로 출력
%i
%d와 같음
%%
% 출력
반응형

'C > Reference' 카테고리의 다른 글

[C] 연산자 우선순위  (0) 2024.12.20
[C] C언어의 지시어(헤더파일, 전처리, 매크로)  (0) 2024.12.20
[C] 난수 생성  (0) 2024.12.20
[C] 시간 지연  (0) 2024.12.20
[C] 2차원 배열 동적 할당  (0) 2024.12.20