SlideShare a Scribd company logo
04 2 오버플로 상수 매크로
• 

•
(0-130 )

• km 

• C
short
2 byte
(16 bit ,
-32768~32767 )
short
2 byte
(16 bit ,
-32768~32767 )
≤
short
2 byte
(16 bit ,
-32768~32767 )
≤
short
2 byte
(16 bit ,
-32768~32767 )
≤
int
short
2 byte
(16 bit ,
-32768~32767 )
≤
int
4 byte
(32 bit ,
-2147483648~2147483647 )
short
2 byte
(16 bit ,
-32768~32767 )
≤
int
4 byte
(32 bit ,
-2147483648~2147483647 )
≤
short
2 byte
(16 bit ,
-32768~32767 )
≤
int
4 byte
(32 bit ,
-2147483648~2147483647 )
≤
short
2 byte
(16 bit ,
-32768~32767 )
≤
int
4 byte
(32 bit ,
-2147483648~2147483647 )
≤
long
short
2 byte
(16 bit ,
-32768~32767 )
≤
int
4 byte
(32 bit ,
-2147483648~2147483647 )
≤
long
8 byte
(64 bit ,
-9223372036854775808 ~ 9223372036854775807)
short short 2 -32768~32767
int 4 -2147483648~2147483647
long long 8
-9223372036854775808~

9223372036854775807
unsigned short short 2 0~65535
unsigned int 4 0~4294967295
unsigned long long 8
0~18446744073709551615

( 1844 )
short short 2 -32768~32767
int 4 -2147483648~2147483647
long long 8
-9223372036854775808~

9223372036854775807
unsigned short short 2 0~65535
unsigned int 4 0~4294967295
unsigned long long 8
0~18446744073709551615

( 1844 )
int CPU .
short short 2 -32768~32767
int 4 -2147483648~2147483647
long long 8
-9223372036854775808~

9223372036854775807
unsigned short short 2 0~65535
unsigned int 4 0~4294967295
unsigned long long 8
0~18446744073709551615

( 1844 )
long 64bit .( )
short short 2 -32768~32767
int 4 -2147483648~2147483647
long long 8
-9223372036854775808~

9223372036854775807
unsigned short short 2 0~65535
unsigned int 4 0~4294967295
unsigned long long 8
0~18446744073709551615

( 1844 )
unsigned .
04 2 오버플로 상수 매크로
04 2 오버플로 상수 매크로
04 2 오버플로 상수 매크로
Lab
.
.
short
.
short
short
32767
.
short
short
32767 +1
1
32768
short
.
short
short
32767 +1
1
-32768
!
overflow.c
Lab
04 2 오버플로 상수 매크로
radius
radius
500


/ /
radius
500


/ /
pi
radius
500


/ /
pi


3.14
12 100 .
12 100 .
sum = 123;
12 100 .
sum = 123;
12 100 .
sum = 123;
12 100 .
sum = 123;
int
int
12 100 .
sum = 123;
int
int
12 100 .
sum = 123;
int
int
sum = 123L;
12 100 .
sum = 123;
int
int
sum = 123L;
.
12 100 .
sum = 123;
int
int
sum = 123L;
long
long
u U unsigned int 123u 123U
l L long 123l 123L
ul UL unsigned long 123ul 123UL
8 16
ex) 10 8
sum = 012;
10 = 1×8¹ + 2×8⁰ = 012₈
8 16
8
ex) 10 8
sum = 012;
10 = 1×8¹ + 2×8⁰ = 012₈
8 16
8
‘0’ .
ex) 10 16
sum = 0xA;
10 = 10×16⁰ = 0xA₁₆
ex) 10 8
sum = 012;
10 = 1×8¹ + 2×8⁰ = 012₈
8 16
8
‘0’ .
16
ex) 10 16
sum = 0xA;
10 = 10×16⁰ = 0xA₁₆
ex) 10 8
sum = 012;
10 = 1×8¹ + 2×8⁰ = 012₈
8 16
8
‘0’ .
16
‘0X’ ‘0x’ .
#include <stdio.h>
#define EXCHANGE_RATE 1120
int main(void)
{
...
won1 = EXCHANGE_RATE * dollar1;
won2 = EXCHANGE_RATE * dollar2;
...
}
#include <stdio.h>
int main(void)
{
...
won1 = 1120 * dollar1;
won2 = 1120 * dollar2;
...
}
#include <stdio.h>
#define EXCHANGE_RATE 1120
int main(void)
{
...
won1 = EXCHANGE_RATE * dollar1;
won2 = EXCHANGE_RATE * dollar2;
...
}
#include <stdio.h>
int main(void)
{
...
won1 = 1120 * dollar1;
won2 = 1120 * dollar2;
...
}
won = 1120 * dollar; // (1)
won = EXCHANGE_RATE * dollar; // (2)
#include <stdio.h>
#define EXCHANGE_RATE 1120
int main(void)
{
...
won1 = EXCHANGE_RATE * dollar1;
won2 = EXCHANGE_RATE * dollar2;
...
}
#include <stdio.h>
int main(void)
{
...
won1 = 1120 * dollar1;
won2 = 1120 * dollar2;
...
}
won = 1120 * dollar; // (1)
won = EXCHANGE_RATE * dollar; // (2)
(literal constant) :
#include <stdio.h>
#define EXCHANGE_RATE 1120
int main(void)
{
...
won1 = EXCHANGE_RATE * dollar1;
won2 = EXCHANGE_RATE * dollar2;
...
}
#include <stdio.h>
int main(void)
{
...
won1 = 1120 * dollar1;
won2 = 1120 * dollar2;
...
}
won = 1120 * dollar; // (1)
won = EXCHANGE_RATE * dollar; // (2)
:
#include <stdio.h>
#define EXCHANGE_RATE 1120
int main(void)
{
...
won1 = EXCHANGE_RATE * dollar1;
won2 = EXCHANGE_RATE * dollar2;
...
}
#include <stdio.h>
int main(void)
{
...
won1 = 1120 * dollar1;
won2 = 1120 * dollar2;
...
}
won = 1120 * dollar; // (1)
won = EXCHANGE_RATE * dollar; // (2)
#include <stdio.h>
#define EXCHANGE_RATE 1120
int main(void)
{
...
won1 = EXCHANGE_RATE * dollar1;
won2 = EXCHANGE_RATE * dollar2;
...
}
#include <stdio.h>
int main(void)
{
...
won1 = 1120 * dollar1;
won2 = 1120 * dollar2;
...
}
won = 1120 * dollar; // (1)
won = EXCHANGE_RATE * dollar; // (2)
1050
1050
#include <stdio.h>
#define EXCHANGE_RATE 1120
int main(void)
{
...
won1 = EXCHANGE_RATE * dollar1;
won2 = EXCHANGE_RATE * dollar2;
...
}
#include <stdio.h>
int main(void)
{
...
won1 = 1120 * dollar1;
won2 = 1120 * dollar2;
...
}
won = 1120 * dollar; // (1)
won = EXCHANGE_RATE * dollar; // (2)
1050
1050
1050
#include <stdio.h>
#define EXCHANGE_RATE 1120
int main(void)
{
...
won1 = EXCHANGE_RATE * dollar1;
won2 = EXCHANGE_RATE * dollar2;
...
}
#include <stdio.h>
int main(void)
{
...
won1 = 1120 * dollar1;
won2 = 1120 * dollar2;
...
}
won = 1120 * dollar; // (1)
won = EXCHANGE_RATE * dollar; // (2)
1050
.
1050
1050
#define
#define
:

#define [ ] [ ]
#define
#define EXCHANGE_RATE 1120
:

#define [ ] [ ]
#define
#define EXCHANGE_RATE 1120
:

#define [ ] [ ]
(preprocessor) [ ] [ ] .
#define
#define EXCHANGE_RATE 1120
:

#define [ ] [ ]
(preprocessor) [ ] [ ] .
#define
#define EXCHANGE_RATE 1120
:

#define [ ] [ ]
(preprocessor) [ ] [ ] .
...
w = EXCHANGE_RATE * 100;
...
#define EXCHANGE_RATE 1120
#define
#define EXCHANGE_RATE 1120
:

#define [ ] [ ]
(preprocessor) [ ] [ ] .
...
w = EXCHANGE_RATE * 100;
...
#define EXCHANGE_RATE 1120
#define
#define EXCHANGE_RATE 1120
:

#define [ ] [ ]
(preprocessor) [ ] [ ] .
...
w = EXCHANGE_RATE * 100;
...
#define EXCHANGE_RATE 1120
...
w = 1120 * 100;
...
• 

• ) radius, circle_area, setCount(), getMax(),…

• 

• _( ,underline) 

• 

• g_ ( )
const
const
:

const [ ] = ;
const
const int EXCHANGE_RATE = 1120;
:

const [ ] = ;
const
const int EXCHANGE_RATE = 1120;
:

const [ ] = ;
const .
const
const int EXCHANGE_RATE = 1120;
:

const [ ] = ;
const .
pi
const
const
const int EXCHANGE_RATE = 1120;
:

const [ ] = ;
const .
pi


const
3.14
Lab
#define const
(type)
const int, char, float
( )
( )
#define const
(type)
const int, char, float
( )
( )
#define const
(type)
const int, char, float
( )
( )
#define const
(type)
const int, char, float
( )
( )
#define const
(type)
const int, char, float
( )
( )
#define const
(type)
const int, char, float
( )
( )
04 2 오버플로 상수 매크로

More Related Content

ODT
linieaire regressie
DOCX
Cara membuat tulisan mengikuti kursor di blog
PDF
Comunicação Bluetooth Entre Python e PyS60
PDF
PDF
Clojure functions examples
PDF
The Ring programming language version 1.2 book - Part 38 of 84
PPT
Mocking Dependencies in PHPUnit
PDF
The Ring programming language version 1.7 book - Part 55 of 196
linieaire regressie
Cara membuat tulisan mengikuti kursor di blog
Comunicação Bluetooth Entre Python e PyS60
Clojure functions examples
The Ring programming language version 1.2 book - Part 38 of 84
Mocking Dependencies in PHPUnit
The Ring programming language version 1.7 book - Part 55 of 196

What's hot (20)

PPTX
LINQ Internals - STLDODN
PDF
Set Operations in Unix Shell
PDF
The Ring programming language version 1.2 book - Part 30 of 84
PDF
Control de acceso con excel
PPT
PDF
Adventures In Data Compilation
PDF
Kotlin의 코루틴은 어떻게 동작하는가
PDF
3分くらいで分かるassert()
PDF
MongoDB Oplog入門
PDF
C++ TUTORIAL 3
PDF
Pymongo for the Clueless
PDF
Burrowing through go! the book
DOCX
3 1-1
PPTX
Everyday's JS
PPT
AP Derivatives
PDF
The Ring programming language version 1.5.2 book - Part 41 of 181
PPTX
Groovy puzzlers jug-moscow-part 2
PPTX
Linked list
PDF
MongoDBで作るソーシャルデータ新解析基盤
PDF
SISTEMA DE FACTURACION (Ejemplo desarrollado)
LINQ Internals - STLDODN
Set Operations in Unix Shell
The Ring programming language version 1.2 book - Part 30 of 84
Control de acceso con excel
Adventures In Data Compilation
Kotlin의 코루틴은 어떻게 동작하는가
3分くらいで分かるassert()
MongoDB Oplog入門
C++ TUTORIAL 3
Pymongo for the Clueless
Burrowing through go! the book
3 1-1
Everyday's JS
AP Derivatives
The Ring programming language version 1.5.2 book - Part 41 of 181
Groovy puzzlers jug-moscow-part 2
Linked list
MongoDBで作るソーシャルデータ新解析基盤
SISTEMA DE FACTURACION (Ejemplo desarrollado)
Ad

Similar to 04 2 오버플로 상수 매크로 (20)

PPT
Functional Pe(a)rls version 2
PDF
ARM 7 LPC 2148 lecture
PPT
PDF
C++ Programming - 4th Study
PDF
C++ practical
PDF
An Introduction to Part of C++ STL
PPT
Lecture#5-Arrays-oral patholohu hfFoP.ppt
PDF
Prelude to halide_public
PPT
Pointers
PPT
FP 201 - Unit 6
PDF
I have written the code but cannot complete the assignment please help.pdf
PPTX
500523224.pptx
PDF
C Code and the Art of Obfuscation
PPT
Pointer
KEY
循環参照のはなし
PPS
Ch 1 part-1 final
PPTX
C++ Lambda and concurrency
PDF
how to reuse code
PDF
include ltiostreamgt include ltstringgt include .pdf
PPTX
C++ Pointers
Functional Pe(a)rls version 2
ARM 7 LPC 2148 lecture
C++ Programming - 4th Study
C++ practical
An Introduction to Part of C++ STL
Lecture#5-Arrays-oral patholohu hfFoP.ppt
Prelude to halide_public
Pointers
FP 201 - Unit 6
I have written the code but cannot complete the assignment please help.pdf
500523224.pptx
C Code and the Art of Obfuscation
Pointer
循環参照のはなし
Ch 1 part-1 final
C++ Lambda and concurrency
how to reuse code
include ltiostreamgt include ltstringgt include .pdf
C++ Pointers
Ad

More from Changwon National University (20)

PDF
생성인공지능둘러보기.pdf
PDF
2011 app center Changwon National Univ.
PDF
인공지능의 파도가 온다
PDF
Mobile Healthcare Application
PDF
PDF
알아두면 편리한 macOS 에디터 단축키와 기능
PDF
키보드 기호의 이름 알아보기(한국어, 영어)
PDF
AI 로봇 아티스트의 비밀(창원대학교 정보통신공학과 특강)
PDF
20 2 강의를 마치며
PDF
20 1 코딩스타일
PDF
18 2 파이썬표준라이브러리
PDF
18 1 파이썬패키지
PDF
17 2 필터함수와 맵함수
PDF
17 1 람다함수
PDF
16 1 상속과super()
PDF
15 2 클래스정의와self
PDF
14 4 슬라이싱
PDF
14 3 리스트함수
PDF
14 1 리스트의 메소드
생성인공지능둘러보기.pdf
2011 app center Changwon National Univ.
인공지능의 파도가 온다
Mobile Healthcare Application
알아두면 편리한 macOS 에디터 단축키와 기능
키보드 기호의 이름 알아보기(한국어, 영어)
AI 로봇 아티스트의 비밀(창원대학교 정보통신공학과 특강)
20 2 강의를 마치며
20 1 코딩스타일
18 2 파이썬표준라이브러리
18 1 파이썬패키지
17 2 필터함수와 맵함수
17 1 람다함수
16 1 상속과super()
15 2 클래스정의와self
14 4 슬라이싱
14 3 리스트함수
14 1 리스트의 메소드

Recently uploaded (20)

PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
PPT on Performance Review to get promotions
PDF
composite construction of structures.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
DOCX
573137875-Attendance-Management-System-original
PDF
Digital Logic Computer Design lecture notes
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Geodesy 1.pptx...............................................
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Well-logging-methods_new................
PPT
Project quality management in manufacturing
PPTX
Sustainable Sites - Green Building Construction
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Structs to JSON How Go Powers REST APIs.pdf
Internet of Things (IOT) - A guide to understanding
Embodied AI: Ushering in the Next Era of Intelligent Systems
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT on Performance Review to get promotions
composite construction of structures.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
573137875-Attendance-Management-System-original
Digital Logic Computer Design lecture notes
OOP with Java - Java Introduction (Basics)
Geodesy 1.pptx...............................................
CYBER-CRIMES AND SECURITY A guide to understanding
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Well-logging-methods_new................
Project quality management in manufacturing
Sustainable Sites - Green Building Construction

04 2 오버플로 상수 매크로