Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- html
- by any chance
- I'm glad
- 명절 표현
- for ing
- gameQA
- 형변환
- C++
- relif
- continue to
- 게임QA
- Realtime Rendering
- sort함수
- ISTQB
- by until
- 명세기반테스트
- 제5인격
- might have p.p
- java
- 변수
- metascore
- keep -ing
- UE4
- end up ing
- 코로나19
- know
- it's a good thing
- if조건절
- counldn't have
- happen to
Archives
- Today
- Total
Records rather than Memories
C programming 본문
#includ <stdio.h> // 기본 라이브러리 추가, printf, scanf 사용가능
int main(void){ // main 함수가 가장 먼저 실행
printf("Hello!!");
return 0; // 반환값 지정
}
#includ <stdio.h>
int main(void){
int x; // 변수 선언
x=5;
printf("%d", x);
printf("변수 x의 메모리 크기는 %d입니다.", sizeof(x)); // sizeof() c언어에서 제공하는 함수 괄호안 메모리 값 제공
return 0;
}
- float y = 123456789.123456789; * float는 실수 변수(4byte까지)
- printf("y = %.2f\n, y); * %.2f 실수를 출력할 때 소수점 두 자리 까지 출력
- double z = 123456789.123456789; * float형보다 많은 8byte까지 저장
- overflow
하나의 오류
#include <stdio.h>
#include <limits.h> * INT_MAX 사용을 위해 필요
int main(void){
int x = INT_MAX; * int형이 가질 수 있는 최대값을 주는 함수, 약 20억
printf("%d", x+1); * 오버플로우 값이 나온다.
return 0;
}
'Software > C' 카테고리의 다른 글
[C++] STL sort() 함수 다루기 (0) | 2019.11.30 |
---|---|
합집합 찾기(Union-Find) (0) | 2019.11.28 |
크루스칼 알고리즘(Kruskal Algorithm) (0) | 2019.11.28 |
최소 비용 신장 트리(MST, Minimum Spanning Tree)란 (0) | 2019.11.26 |
그리디 알고리즘 (Greedy) (0) | 2019.11.25 |
Comments