Skip to content

Instantly share code, notes, and snippets.

@nattybear
Created June 4, 2017 00:31
Show Gist options
  • Select an option

  • Save nattybear/7a6d381ac095dc69ac2f1c9545284b67 to your computer and use it in GitHub Desktop.

Select an option

Save nattybear/7a6d381ac095dc69ac2f1c9545284b67 to your computer and use it in GitHub Desktop.
C언어 서식문자 - %o와 %x
#include <stdio.h>
int main() {
int a = 8;
int b = 16;
// 10진수 8을 8진수로 출력한다.
printf("%o\n", a);
// 10진수 16을 16진수로 출력한다.
printf("%x\n", b);
return 0;
}
@nattybear

nattybear commented Jun 4, 2017

Copy link
Copy Markdown
Author

%o랑 %d는 연산자가 아니라 서식문자

  • %o랑 %d는 연산자가 아니라 서식문자
  • C언어에서 서식문자를 사용할 때는 #은 무조건 들어가지 않아도 상관 없어
  • 아니 그보다 #은 도대체 언제 넣는건데?ㅎ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment