ex)
int a = 2;
printf("%d + %d = %d", 1, a, 1 + a);
#include <stdio.h>
#include <limits.h>
#include <float.h>
#define PI 3.141592f // manifest constants, symbolic constants
int main()
{
double d = 3.14159265358979323846264338327950288419716939937510;
printf("%c\n", 'A'); // 한 글자 표현 ''
printf("%s", "I love you.\n"); // string
printf("Even if there's a small chance, \
we owe this to everyone who's not in this room to try.\n"); // 줄바꿈 할 때 \ 필수..! \ 없이 줄바꿈하면 컴파일 에러 발생
printf("\n");
printf("%d %i %i %i\n", 1004, 1234, INT_MAX, UINT_MAX); // 1004, 1234, 2147483647, -1
// UINT_MAX 를 integer 에 집어넣었으므로 overflow 발생
printf("%u %u %u\n", 1024, -1, UINT_MAX); // 1024, 4294967295, 4294967295
// 음수를 unsigned integer 에 집어넣었으므로 이상한 수가 튀어나옴
printf("\n");
printf("%f %f %lf\n", 3.141592f, d, d); // d 는 절삭된 채로 출력. l in %lf is igored
printf("%a %A \n", d, d); // 0x1.921fb54442d18p+1 0X1.921FB54442D18P+1
printf("%e %E \n", d, d); // 3.141593e+00 3.141593E+00
printf("\n");
printf("%g %g\n", 123456.789, 1234567.89); // 123457 1.23457e+06
printf("%G %G\n", 123456.789, 1234567.89); // 123457 1.23457E+06
printf("%g %g\n", 0.00012345, 0.000012345); // 0.00012345 1.2345e-05
printf("%g %g\n", 0.00012345, 0.000012345); // 0.00012345 1.2345e-05
// 자리 모자라면 E를 이용하여 지수꼴로 표현.
printf("\n");
printf("%o\n", 9); // 11 (8진수)
printf("%P\n", &d); // pointer-of operator.. 주소 나타냄.
printf("\n");
printf("%x %x\n", 11, 11); // b B (16진수)
printf("%%\n", d); // % // 여기서 d는 무시된다.
printf("\n");
printf("%9d\n", 12345); // 9d면 최소 9자리 출력. ____12345 출력
printf("%09d\n", 12345); // 09면 남는 자리 0으로 채움. 000012345
printf("%.2f\n", 3.141592); //.2 면 소수점 두 자리 .. 3.14
printf("%.20f %.20lf\n", d, d); // .20은 소수점 20자리 출력.
printf("\n");
int n_printed = printf("Counting!");
printf("%u\n", n_printed); // 9Counting! 9는 글자 개수
return 0;
}