1 개념[ | ]
- C언어 출력 방법
- printf(프린트에프)는 C언어 표준 출력 함수
2 printf[ | ]
- Hello World 문자열 출력
C
Copy
#include <stdio.h>
int main(void)
{
printf( "Hello World");
}
Loading
- → 문자열인 "Hello World"를 받아 출력된다.
- 변수 a에 담긴 숫자 10 출력
C
Copy
#include <stdio.h>
int main(void)
{
int a = 10;
printf("%d", a);
}
Loading
- → %d는 변수 a의 값을 받아 출력된다.
- → int a는 정수만 담을 수 있다.
- → 실수를 담고 싶으면 float 로 바꾸면 된다.
C
Copy
#include <stdio.h>
int main(void)
{
float a = 10.5;
printf("%f", a);
}
Loading
- → %d 는 정수를, %f 는 실수를 나타낸다.
편집자 180.81.77.112 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.