SlideShare a Scribd company logo
1 of 19
Download to read offline
Pointer
2
Pointer Declaration and Assignment
ยง Variables and address
โ€“ ๋ฉ”๋ชจ๋ฆฌ์˜ ๊ตฌ์กฐ
โ€“ ๊ฐ ๋ณ€์ˆ˜๋Š” ๋ฉ”๋ชจ๋ฆฌ์˜ ํŠน์ • ์ฃผ์†Œ์— ์œ„์น˜ ํ•œ๋‹ค
โ€ข ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ: Pointer
โ€ฆ
1000 โ€˜aโ€™
1001
3.2
1005
4
โ€ฆ
ch, 1byte
f, 4bytes
i, 4bytes
char ch = โ€˜aโ€™ ;
float f = 3.2 ;
int i = 4 ;
address
3
Pointer Declaration and Assignment
ยง Variables and address
โ€“ ๋ณ€์ˆ˜๋ถ€ํ„ฐ ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ(Pointer) ์–ป์–ด๋‚ด๊ธฐ
char ch = โ€˜aโ€™ ;
float f = 3.2 ;
int i = 4 ;
printf( โ€œ%d %d %dnโ€, &a, &f, &i ) ;
&(๋ณ€์ˆ˜์ด๋ฆ„) == ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ โ€ฆ
1000 โ€˜aโ€™
1001
3.2
1005
4
โ€ฆ
Address
operator
4
Pointer Declaration and Assignment
ยง Variables and address
โ€“ ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ(Pointer)๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ณ€์ˆ˜ ์ ‘๊ทผํ•˜๊ธฐ
char ch ;
float f ;
int i ;
*(&ch) = โ€˜aโ€™ ;
*(&f) = 3.2 ;
*(&i) = 4 ;
*(์ฃผ์†Œ)๋Š” (์ฃผ์†Œ)์— ์œ„์น˜ํ•œ ๋ณ€์ˆ˜๋ฅผ ๋œปํ•จ
โ€ฆ
1000 โ€˜aโ€™
1001
3.2
1005
4
โ€ฆ
char ch ;
float f ;
int i ;
ch = โ€˜aโ€™ ;
f = 3.2 ;
i = 4 ;
Indirect
operator
5
Pointer Declaration and Assignment
ยง Pointer Variable
โ€“ โ€œ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ(Pointer)โ€๋ฅผ ๊ฐ’์„ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜
char ch = โ€˜aโ€™ ;
float f = 3.2 ;
int i = 4 ;
char *pch ;
float *pf ;
int *pi ;
pch = &ch ;
pf = &f ;
pi = &i ;
printf( โ€œ%d %d %dnโ€, pch, pf, pi ) ;
data_type * pointer_varaible;
char ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋งŒ์„
์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜
float ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋งŒ์„
์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜
int ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋งŒ์„
์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜
char *pch = &ch ;
float *pf = &f ;
int *pi = &i ;
6
Pointer Declaration and Assignment
ยง Pointer Variable
char ch ;
float f ;
int i ;
ch = โ€˜aโ€™ ;
f = 3.2 ;
i = 4 ;
char ch ;
float f ;
int i ;
char *pch = &ch ;
float *pf = &f ;
int *pi = &i ;
*pch = โ€˜aโ€™ ;
*pf = 3.2 ;
*pi = 4 ;
โ€ฆ
1000 โ€˜aโ€™
1001
3.2
1005
4
โ€ฆ
7
Pointer Declaration and Assignment
ยง Pointer Variable
โ€“ ๋ชจ๋“  pointer ๋ณ€์ˆ˜๋Š” 4 bytes ํฌ๊ธฐ์ด๋‹ค (4 bytes machine)
โ€ข why??
char *pch ;
float *pf ;
int *pi ;
printf( โ€œ%dnโ€, sizeof(pch) ) ;
printf( โ€œ%dnโ€, sizeof(pf) ) ;
printf( โ€œ%dnโ€, sizeof(pi) ) ;
int i = 0 ;
int *pi = & i;
printf( โ€œ%dnโ€, i ) ;
printf( โ€œ%dnโ€, *pi ) ;
printf( โ€œ%dnโ€, &pi ) ;
8
Pointer Declaration and Assignment
ยง Pointer Variable
โ€“ ๋ชจ๋“  pointer ๋ณ€์ˆ˜๋„ ๋ณ€์ˆ˜์ด๋ฏ€๋กœ ์ฃผ์†Œ๋ฅผ ๊ฐ–๋Š”๋‹ค.
int i = 0 ;
int *pi = &i;
printf( โ€œ%dnโ€, i ) ;
printf( โ€œ%dnโ€, *pi ) ;
printf( โ€œ%dnโ€, &pi ) ;
1000
โ€ฆ
1020
โ€ฆ
pi, 4 bytes
i, 4 bytes
9
Pointer Declaration and Assignment
[Ex] int *p;
int month=3;
p = &month;
pointer variable p์—
month์˜ memory address๋ฅผ assign
p month
3
p
1000
month
31000
์ฃผ์†Œ๋ฅผ ์ง์ ‘ ์ ๋Š” ๊ฒƒ๋ณด๋‹ค๋Š”
ํ™”์‚ดํ‘œ๋ฅผ ์ด์šฉํ•˜์—ฌ ํ‘œ์‹œํ•œ๋‹ค.
ยง Example
10
Addressing and Dereferencing
[Ex] int a, b;
int *p;
a = 7;
b = 7;
p = &a;
printf(โ€œ*p = %dnโ€, *p);
*p = 3;
printf(โ€œa = %dnโ€, a);
p๋Š” a๋ฅผ pointingํ•˜๋ฏ€๋กœ, *p == 7
p๋Š” a์˜ address๋ฅผ ์ €์žฅํ•˜๊ณ 
์žˆ์œผ๋ฏ€๋กœ, *p๋Š” a๋ฅผ ์˜๋ฏธํ•˜๊ณ ,
๊ฒฐ๊ตญ a์˜ ๋‚ด์šฉ์„ 3์œผ๋กœ ๋ณ€๊ฒฝ
p์— a์˜ memory address๋ฅผ assign
*p = 7
a = 3
ยง Example
11
Addressing and Dereferencing
[Ex1] int a, b;
int *p;
a = b = 7;
p = &a;
*p = 3;
p = &b;
*p = 2 * *p โ€“ a;
pa
7
b
7
p
3
a b
7
pa
3 11
b
ยง Example
12
Addressing and Dereferencing
[Ex1] int x, *p;
x = 10;
*p = x;
[Ex3] int x, *p;
x = 10;
p = x;
Error!!
p์˜ ๊ฐ’์ด ์ฃผ์–ด์ง€์ง€ ์•Š์•„ p๊ฐ€ ์–ด๋Š ๊ณณ์„
referํ•˜๊ณ  ์žˆ๋Š”์ง€๋ฅผ ๋ชจ๋ฅด๋Š” ์ƒํ™ฉ์—์„œ
p๊ฐ€ pointํ•˜๋Š” ๊ณณ์— x๊ฐ’ ์ž…๋ ฅ ๋ถˆ๊ฐ€
Error!!
p๋Š” address๋ฅผ ๊ฐ’์œผ๋กœ ํ•˜๋Š” point
variable์ด๋ฏ€๋กœ int์˜ assign์€ ๋ถˆ๊ฐ€
ยง ํ•˜๊ธฐ ์‰ฌ์šด ์—๋Ÿฌ
13
const ์™€ Pointer ๋ณ€์ˆ˜
ยง const ์™€ Pointer ๋ณ€์ˆ˜
โ€“ p๋Š” const int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜
โ€“ a๋Š” ์ƒ์ˆ˜๋ณ€์ˆ˜๋กœ ๊ฐ’์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์—†์Œ.
โ€“ p๊ฐ€ ๊ฐ€๋ฅดํ‚ค๋Š” ๋ณ€์ˆ˜๋Š” ์ƒ์ˆ˜๋ณ€์ˆ˜์ด๋ฏ€๋กœ p๋ฅผ ํ†ตํ•œ ๋ณ€๊ฒฝ๋ถˆ๊ฐ€
const int a = 7;
const int *p = &a; // ๊ฐ€๋Šฅ
a = 8 ; //๋ถˆ๊ฐ€๋Šฅ
*p = 9 ; //๋ถˆ๊ฐ€๋Šฅ
14
const ์™€ Pointer ๋ณ€์ˆ˜
ยง const ์™€ Pointer ๋ณ€์ˆ˜
โ€“ p๋Š” const int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์ด
์ง€๋งŒ, ์ผ๋ฐ˜ int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ์Œ.
โ€“ a๋Š” ์ผ๋ฐ˜ ๋ณ€์ˆ˜๋กœ ๊ฐ’์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์Œ.
โ€“ p๊ฐ€ ๊ฐ€๋ฅดํ‚ค๋Š” ๋ณ€์ˆ˜๊ฐ€ ์ผ๋ฐ˜๋ณ€์ˆ˜์ด๊ธฐ๋Š” ํ•˜๋‚˜, p๊ฐ€ const int์˜ ํฌ
์ธํ„ฐ๋กœ ์„ ์–ธ๋˜์—ˆ์œผ๋ฏ€๋กœ, p๋ฅผ ํ†ตํ•œ ๋ณ€๊ฒฝ๋ถˆ๊ฐ€
int a = 7;
const int *p = &a; // ๊ฐ€๋Šฅ
a = 8 ; //๊ฐ€๋Šฅ
*p = 9 ; //๋ถˆ๊ฐ€๋Šฅ
15
const ์™€ Pointer ๋ณ€์ˆ˜
ยง const ์™€ Pointer ๋ณ€์ˆ˜
โ€“ p๋Š” ์ผ๋ฐ˜ int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์ด๋ฏ€
๋กœ, ์ƒ์ˆ˜๋ณ€์ˆ˜ a์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์—†์Œ.
โ€“ ๋งŒ์•ฝ ์ด๊ฒƒ์ด ๋œ๋‹ค๋ฉด *p=8 ์ด ๊ฐ€๋Šฅํ•˜๊ณ  ๊ฒฐ๊ตญ a์˜ ๊ฐ’์„ ๋ฐ”๊ฟ€ ์ˆ˜
์žˆ๊ฒŒ ๋จ.
const int a = 7;
int *p = &a; // ๋ถˆ๊ฐ€๋Šฅ
16
const ์™€ Pointer ๋ณ€์ˆ˜
ยง const ์™€ Pointer ๋ณ€์ˆ˜
โ€“ p๋Š” const int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์ด
๋ฏ€๋กœ ๋ชจ๋‘ ๊ฐ€๋Šฅ
โ€“ p๋Š” const int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•˜๋Š” ์ƒ์ˆ˜ ๋ณ€์ˆ˜์ด๋ฏ€๋กœ, ์ฒซ
์ดˆ๊ธฐํ™”๋Š” ๊ฐ€๋Šฅํ•˜์ง€๋งŒ, ๊ทธ ์ดํ›„ ์น˜ํ™˜์€ ๋ถˆ๊ฐ€๋Šฅ
const int a = 7, b = 8 ;
const int * p = &a; // ๊ฐ€๋Šฅ
p = &b; //๊ฐ€๋Šฅ
const int a = 7, b = 8 ;
const int * const p = &a; // ๊ฐ€๋Šฅ
p = &b; // ๋ถˆ๊ฐ€๋Šฅ
17
๋‹ค์ค‘ Pointer ๋ณ€์ˆ˜
ยง ๋‹ค์ค‘ Pointer ๋ณ€์ˆ˜
โ€“ i๋Š” intํ˜• ๋ณ€์ˆ˜
โ€“ p๋Š” intํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜
โ€“ q๋Š” intํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•˜๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅ
ํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜
โ€ข q๋„ ํฌ์ธํ„ฐ๋ณ€์ˆ˜์ด๊ธฐ ๋•Œ๋ฌธ์— ํฌ๊ธฐ๋Š” 4๋ฐ”์ดํŠธ์ด๋‹ค(4 bytes machine)
int i = 4 ;
int *p ;
int **q ;
ยง Example
18
Pointer Declaration and Assignment
[Ex] int i = 3;
int *p ;
int **q ;
p = &i ;
q = &p ;
p i
3
i
31000
p
10002000
q
20003000
q
ยง Example:
โ€“ ๊ฐ ๋‹จ๊ณ„์˜ ๋ฉ”๋ชจ๋ฆฌ ์ƒํƒœ๋ฅผ ๊ทธ๋ฆผ์œผ
๋กœ ๊ทธ๋ฆฌ์‹œ์˜ค.
โ€“ ์ตœ์ข…์ ์œผ๋กœ, i, j ๋ณ€์ˆ˜์˜ ๊ฐ’์€ ์–ผ๋งˆ
์ธ๊ฐ€?
โ€“ i, j, p, q์˜ ์ฃผ์†Œ๋ฅผ ๊ฐ๊ฐ 1000,
1004, 2000, 3000 ์ด๋ผ๋ฉด, p, q, r
์˜ ๊ฐ’์€ ๊ฐ๊ฐ ์–ผ๋งˆ์ธ๊ฐ€?
19
Pointer Declaration and Assignment
[Ex] int i = 3, j = 2;
int *p, *q ;
int **r ;
p = &i ;
q = &j ;
r = &p ;
*p = 4 ;
*q = 5 ;
**r = 6 ;
*r = &q ;
q =&i ;
**r = 7 ;

More Related Content

What's hot

03. function in typescript
03. function in typescript03. function in typescript
03. function in typescriptHan JaeYeab
ย 
07. type system
07. type system07. type system
07. type systemHan JaeYeab
ย 
01. basic types
01. basic types01. basic types
01. basic typesHan JaeYeab
ย 
แ„Œแ…ฅแ†ผแ„€แ…ฒแ„‘แ…ญแ„’แ…งแ†ซแ„‰แ…ตแ†จ์˜ ์ดํ•ด์™€ ํ™œ์šฉ
แ„Œแ…ฅแ†ผแ„€แ…ฒแ„‘แ…ญแ„’แ…งแ†ซแ„‰แ…ตแ†จ์˜ ์ดํ•ด์™€ ํ™œ์šฉแ„Œแ…ฅแ†ผแ„€แ…ฒแ„‘แ…ญแ„’แ…งแ†ซแ„‰แ…ตแ†จ์˜ ์ดํ•ด์™€ ํ™œ์šฉ
แ„Œแ…ฅแ†ผแ„€แ…ฒแ„‘แ…ญแ„’แ…งแ†ซแ„‰แ…ตแ†จ์˜ ์ดํ•ด์™€ ํ™œ์šฉ์˜ค์„ ํ•œ
ย 
Lua ๋ฌธ๋ฒ•
Lua ๋ฌธ๋ฒ•Lua ๋ฌธ๋ฒ•
Lua ๋ฌธ๋ฒ•Jaehoon Lee
ย 
์ž๋ฐ” ์Šคํ„ฐ๋””(6๊ธฐ) 1
์ž๋ฐ” ์Šคํ„ฐ๋””(6๊ธฐ) 1์ž๋ฐ” ์Šคํ„ฐ๋””(6๊ธฐ) 1
์ž๋ฐ” ์Šคํ„ฐ๋””(6๊ธฐ) 1Jina Lee
ย 
Hello python 3ํšŒ ์ž๋ฃŒํ˜•๊ณผ ํ•จ์ˆ˜(ํŒŒ์ด์ฌ ์Šคํ„ฐ๋””, ๋ฐœํ‘œ์ž๋ฃŒ)
Hello python 3ํšŒ ์ž๋ฃŒํ˜•๊ณผ ํ•จ์ˆ˜(ํŒŒ์ด์ฌ ์Šคํ„ฐ๋””, ๋ฐœํ‘œ์ž๋ฃŒ)Hello python 3ํšŒ ์ž๋ฃŒํ˜•๊ณผ ํ•จ์ˆ˜(ํŒŒ์ด์ฌ ์Šคํ„ฐ๋””, ๋ฐœํ‘œ์ž๋ฃŒ)
Hello python 3ํšŒ ์ž๋ฃŒํ˜•๊ณผ ํ•จ์ˆ˜(ํŒŒ์ด์ฌ ์Šคํ„ฐ๋””, ๋ฐœํ‘œ์ž๋ฃŒ)Cherucy
ย 
Lua ๋ฌธ๋ฒ• -ํ•จ์ˆ˜
Lua ๋ฌธ๋ฒ• -ํ•จ์ˆ˜Lua ๋ฌธ๋ฒ• -ํ•จ์ˆ˜
Lua ๋ฌธ๋ฒ• -ํ•จ์ˆ˜Jaehoon Lee
ย 
C++11
C++11C++11
C++11Yubin Lim
ย 
[Swift] Type inference
[Swift] Type inference[Swift] Type inference
[Swift] Type inferenceBill Kim
ย 
Ruby - 6th (๋ฃจ๋น„ 6์žฅ ๋ณ€์ˆ˜์™€ ์‹)
Ruby - 6th (๋ฃจ๋น„ 6์žฅ ๋ณ€์ˆ˜์™€ ์‹)Ruby - 6th (๋ฃจ๋น„ 6์žฅ ๋ณ€์ˆ˜์™€ ์‹)
Ruby - 6th (๋ฃจ๋น„ 6์žฅ ๋ณ€์ˆ˜์™€ ์‹)์žฌ์˜ ์ด
ย 
๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ํšจ๊ณผ
๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ํšจ๊ณผ๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ํšจ๊ณผ
๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ํšจ๊ณผ๋ฏผ์šฑ ์ด
ย 
[Effective Modern C++] Chapter1 - item2
[Effective Modern C++] Chapter1 - item2[Effective Modern C++] Chapter1 - item2
[Effective Modern C++] Chapter1 - item2์ง€ํ™˜ ๊น€
ย 
Basic study 2ํšŒ์ฐจ
Basic study 2ํšŒ์ฐจBasic study 2ํšŒ์ฐจ
Basic study 2ํšŒ์ฐจSeonmun Choi
ย 
[Effective Modern C++] Chapter1 - item1
[Effective Modern C++] Chapter1 - item1[Effective Modern C++] Chapter1 - item1
[Effective Modern C++] Chapter1 - item1์ง€ํ™˜ ๊น€
ย 
Secure coding-c-preprocessor-1
Secure coding-c-preprocessor-1Secure coding-c-preprocessor-1
Secure coding-c-preprocessor-1Seungyong Lee
ย 
7๊ทธ๋ฃน ์ฝ”๋“œ
7๊ทธ๋ฃน ์ฝ”๋“œ7๊ทธ๋ฃน ์ฝ”๋“œ
7๊ทธ๋ฃน ์ฝ”๋“œherojoon1378
ย 
C์ˆ˜์—…์ž๋ฃŒ
C์ˆ˜์—…์ž๋ฃŒC์ˆ˜์—…์ž๋ฃŒ
C์ˆ˜์—…์ž๋ฃŒkoominsu
ย 
์ž๋ฃŒ๊ตฌ์กฐ ๊ทธ๋ž˜ํ”„ ๋ณด๊ณ ์„œ
์ž๋ฃŒ๊ตฌ์กฐ ๊ทธ๋ž˜ํ”„ ๋ณด๊ณ ์„œ์ž๋ฃŒ๊ตฌ์กฐ ๊ทธ๋ž˜ํ”„ ๋ณด๊ณ ์„œ
์ž๋ฃŒ๊ตฌ์กฐ ๊ทธ๋ž˜ํ”„ ๋ณด๊ณ ์„œmil23
ย 

What's hot (20)

03. function in typescript
03. function in typescript03. function in typescript
03. function in typescript
ย 
07. type system
07. type system07. type system
07. type system
ย 
01. basic types
01. basic types01. basic types
01. basic types
ย 
แ„Œแ…ฅแ†ผแ„€แ…ฒแ„‘แ…ญแ„’แ…งแ†ซแ„‰แ…ตแ†จ์˜ ์ดํ•ด์™€ ํ™œ์šฉ
แ„Œแ…ฅแ†ผแ„€แ…ฒแ„‘แ…ญแ„’แ…งแ†ซแ„‰แ…ตแ†จ์˜ ์ดํ•ด์™€ ํ™œ์šฉแ„Œแ…ฅแ†ผแ„€แ…ฒแ„‘แ…ญแ„’แ…งแ†ซแ„‰แ…ตแ†จ์˜ ์ดํ•ด์™€ ํ™œ์šฉ
แ„Œแ…ฅแ†ผแ„€แ…ฒแ„‘แ…ญแ„’แ…งแ†ซแ„‰แ…ตแ†จ์˜ ์ดํ•ด์™€ ํ™œ์šฉ
ย 
Lua ๋ฌธ๋ฒ•
Lua ๋ฌธ๋ฒ•Lua ๋ฌธ๋ฒ•
Lua ๋ฌธ๋ฒ•
ย 
์ž๋ฐ” ์Šคํ„ฐ๋””(6๊ธฐ) 1
์ž๋ฐ” ์Šคํ„ฐ๋””(6๊ธฐ) 1์ž๋ฐ” ์Šคํ„ฐ๋””(6๊ธฐ) 1
์ž๋ฐ” ์Šคํ„ฐ๋””(6๊ธฐ) 1
ย 
Hello python 3ํšŒ ์ž๋ฃŒํ˜•๊ณผ ํ•จ์ˆ˜(ํŒŒ์ด์ฌ ์Šคํ„ฐ๋””, ๋ฐœํ‘œ์ž๋ฃŒ)
Hello python 3ํšŒ ์ž๋ฃŒํ˜•๊ณผ ํ•จ์ˆ˜(ํŒŒ์ด์ฌ ์Šคํ„ฐ๋””, ๋ฐœํ‘œ์ž๋ฃŒ)Hello python 3ํšŒ ์ž๋ฃŒํ˜•๊ณผ ํ•จ์ˆ˜(ํŒŒ์ด์ฌ ์Šคํ„ฐ๋””, ๋ฐœํ‘œ์ž๋ฃŒ)
Hello python 3ํšŒ ์ž๋ฃŒํ˜•๊ณผ ํ•จ์ˆ˜(ํŒŒ์ด์ฌ ์Šคํ„ฐ๋””, ๋ฐœํ‘œ์ž๋ฃŒ)
ย 
Lua ๋ฌธ๋ฒ• -ํ•จ์ˆ˜
Lua ๋ฌธ๋ฒ• -ํ•จ์ˆ˜Lua ๋ฌธ๋ฒ• -ํ•จ์ˆ˜
Lua ๋ฌธ๋ฒ• -ํ•จ์ˆ˜
ย 
C++11
C++11C++11
C++11
ย 
[Swift] Type inference
[Swift] Type inference[Swift] Type inference
[Swift] Type inference
ย 
Ruby - 6th (๋ฃจ๋น„ 6์žฅ ๋ณ€์ˆ˜์™€ ์‹)
Ruby - 6th (๋ฃจ๋น„ 6์žฅ ๋ณ€์ˆ˜์™€ ์‹)Ruby - 6th (๋ฃจ๋น„ 6์žฅ ๋ณ€์ˆ˜์™€ ์‹)
Ruby - 6th (๋ฃจ๋น„ 6์žฅ ๋ณ€์ˆ˜์™€ ์‹)
ย 
๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ํšจ๊ณผ
๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ํšจ๊ณผ๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ํšจ๊ณผ
๋ณ€์ˆ˜ ์ด๋ฆ„์˜ ํšจ๊ณผ
ย 
[Effective Modern C++] Chapter1 - item2
[Effective Modern C++] Chapter1 - item2[Effective Modern C++] Chapter1 - item2
[Effective Modern C++] Chapter1 - item2
ย 
Basic study 2ํšŒ์ฐจ
Basic study 2ํšŒ์ฐจBasic study 2ํšŒ์ฐจ
Basic study 2ํšŒ์ฐจ
ย 
[Effective Modern C++] Chapter1 - item1
[Effective Modern C++] Chapter1 - item1[Effective Modern C++] Chapter1 - item1
[Effective Modern C++] Chapter1 - item1
ย 
Secure coding-c-preprocessor-1
Secure coding-c-preprocessor-1Secure coding-c-preprocessor-1
Secure coding-c-preprocessor-1
ย 
(๋‹ท๋„ท, C#๊ธฐ์ดˆ๊ต์œก)C#์„ ํƒ์ ์ธ์ˆ˜, ๋ช…๋ช…๋œ ์ธ์ˆ˜
(๋‹ท๋„ท, C#๊ธฐ์ดˆ๊ต์œก)C#์„ ํƒ์ ์ธ์ˆ˜, ๋ช…๋ช…๋œ ์ธ์ˆ˜(๋‹ท๋„ท, C#๊ธฐ์ดˆ๊ต์œก)C#์„ ํƒ์ ์ธ์ˆ˜, ๋ช…๋ช…๋œ ์ธ์ˆ˜
(๋‹ท๋„ท, C#๊ธฐ์ดˆ๊ต์œก)C#์„ ํƒ์ ์ธ์ˆ˜, ๋ช…๋ช…๋œ ์ธ์ˆ˜
ย 
7๊ทธ๋ฃน ์ฝ”๋“œ
7๊ทธ๋ฃน ์ฝ”๋“œ7๊ทธ๋ฃน ์ฝ”๋“œ
7๊ทธ๋ฃน ์ฝ”๋“œ
ย 
C์ˆ˜์—…์ž๋ฃŒ
C์ˆ˜์—…์ž๋ฃŒC์ˆ˜์—…์ž๋ฃŒ
C์ˆ˜์—…์ž๋ฃŒ
ย 
์ž๋ฃŒ๊ตฌ์กฐ ๊ทธ๋ž˜ํ”„ ๋ณด๊ณ ์„œ
์ž๋ฃŒ๊ตฌ์กฐ ๊ทธ๋ž˜ํ”„ ๋ณด๊ณ ์„œ์ž๋ฃŒ๊ตฌ์กฐ ๊ทธ๋ž˜ํ”„ ๋ณด๊ณ ์„œ
์ž๋ฃŒ๊ตฌ์กฐ ๊ทธ๋ž˜ํ”„ ๋ณด๊ณ ์„œ
ย 

More from ์›…์‹ ์ „

15 2. arguement passing to main
15 2. arguement passing to main15 2. arguement passing to main
15 2. arguement passing to main์›…์‹ ์ „
ย 
12 1. multi-dimensional array
12 1. multi-dimensional array12 1. multi-dimensional array
12 1. multi-dimensional array์›…์‹ ์ „
ย 
7. variable scope rule,-storage_class
7. variable scope rule,-storage_class7. variable scope rule,-storage_class
7. variable scope rule,-storage_class์›…์‹ ์ „
ย 
3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib์›…์‹ ์ „
ย 
Goorm ide ๊ต์œก์šฉ๋ฒ„์ „ for skku(ํ•™์ƒ)
Goorm ide ๊ต์œก์šฉ๋ฒ„์ „ for skku(ํ•™์ƒ)Goorm ide ๊ต์œก์šฉ๋ฒ„์ „ for skku(ํ•™์ƒ)
Goorm ide ๊ต์œก์šฉ๋ฒ„์ „ for skku(ํ•™์ƒ)์›…์‹ ์ „
ย 
๊ตฌ๋ฆ„ ๊ธฐ๋ณธ ์†Œ๊ฐœ์ž๋ฃŒ
๊ตฌ๋ฆ„ ๊ธฐ๋ณธ ์†Œ๊ฐœ์ž๋ฃŒ๊ตฌ๋ฆ„ ๊ธฐ๋ณธ ์†Œ๊ฐœ์ž๋ฃŒ
๊ตฌ๋ฆ„ ๊ธฐ๋ณธ ์†Œ๊ฐœ์ž๋ฃŒ์›…์‹ ์ „
ย 

More from ์›…์‹ ์ „ (20)

15 3. modulization
15 3. modulization15 3. modulization
15 3. modulization
ย 
15 2. arguement passing to main
15 2. arguement passing to main15 2. arguement passing to main
15 2. arguement passing to main
ย 
14. fiile io
14. fiile io14. fiile io
14. fiile io
ย 
13. structure
13. structure13. structure
13. structure
ย 
12 2. dynamic allocation
12 2. dynamic allocation12 2. dynamic allocation
12 2. dynamic allocation
ย 
12 1. multi-dimensional array
12 1. multi-dimensional array12 1. multi-dimensional array
12 1. multi-dimensional array
ย 
11. array & pointer
11. array & pointer11. array & pointer
11. array & pointer
ย 
10. pointer & function
10. pointer & function10. pointer & function
10. pointer & function
ย 
7. variable scope rule,-storage_class
7. variable scope rule,-storage_class7. variable scope rule,-storage_class
7. variable scope rule,-storage_class
ย 
6. function
6. function6. function
6. function
ย 
5 2. string processing
5 2. string processing5 2. string processing
5 2. string processing
ย 
5 1. character processing
5 1. character processing5 1. character processing
5 1. character processing
ย 
4. loop
4. loop4. loop
4. loop
ย 
3 2. if statement
3 2. if statement3 2. if statement
3 2. if statement
ย 
3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib
ย 
2 3. standard io
2 3. standard io2 3. standard io
2 3. standard io
ย 
2 2. operators
2 2. operators2 2. operators
2 2. operators
ย 
2 1. variables & data types
2 1. variables & data types2 1. variables & data types
2 1. variables & data types
ย 
Goorm ide ๊ต์œก์šฉ๋ฒ„์ „ for skku(ํ•™์ƒ)
Goorm ide ๊ต์œก์šฉ๋ฒ„์ „ for skku(ํ•™์ƒ)Goorm ide ๊ต์œก์šฉ๋ฒ„์ „ for skku(ํ•™์ƒ)
Goorm ide ๊ต์œก์šฉ๋ฒ„์ „ for skku(ํ•™์ƒ)
ย 
๊ตฌ๋ฆ„ ๊ธฐ๋ณธ ์†Œ๊ฐœ์ž๋ฃŒ
๊ตฌ๋ฆ„ ๊ธฐ๋ณธ ์†Œ๊ฐœ์ž๋ฃŒ๊ตฌ๋ฆ„ ๊ธฐ๋ณธ ์†Œ๊ฐœ์ž๋ฃŒ
๊ตฌ๋ฆ„ ๊ธฐ๋ณธ ์†Œ๊ฐœ์ž๋ฃŒ
ย 

9. pointer

  • 2. 2 Pointer Declaration and Assignment ยง Variables and address โ€“ ๋ฉ”๋ชจ๋ฆฌ์˜ ๊ตฌ์กฐ โ€“ ๊ฐ ๋ณ€์ˆ˜๋Š” ๋ฉ”๋ชจ๋ฆฌ์˜ ํŠน์ • ์ฃผ์†Œ์— ์œ„์น˜ ํ•œ๋‹ค โ€ข ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ: Pointer โ€ฆ 1000 โ€˜aโ€™ 1001 3.2 1005 4 โ€ฆ ch, 1byte f, 4bytes i, 4bytes char ch = โ€˜aโ€™ ; float f = 3.2 ; int i = 4 ; address
  • 3. 3 Pointer Declaration and Assignment ยง Variables and address โ€“ ๋ณ€์ˆ˜๋ถ€ํ„ฐ ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ(Pointer) ์–ป์–ด๋‚ด๊ธฐ char ch = โ€˜aโ€™ ; float f = 3.2 ; int i = 4 ; printf( โ€œ%d %d %dnโ€, &a, &f, &i ) ; &(๋ณ€์ˆ˜์ด๋ฆ„) == ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ โ€ฆ 1000 โ€˜aโ€™ 1001 3.2 1005 4 โ€ฆ Address operator
  • 4. 4 Pointer Declaration and Assignment ยง Variables and address โ€“ ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ(Pointer)๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ณ€์ˆ˜ ์ ‘๊ทผํ•˜๊ธฐ char ch ; float f ; int i ; *(&ch) = โ€˜aโ€™ ; *(&f) = 3.2 ; *(&i) = 4 ; *(์ฃผ์†Œ)๋Š” (์ฃผ์†Œ)์— ์œ„์น˜ํ•œ ๋ณ€์ˆ˜๋ฅผ ๋œปํ•จ โ€ฆ 1000 โ€˜aโ€™ 1001 3.2 1005 4 โ€ฆ char ch ; float f ; int i ; ch = โ€˜aโ€™ ; f = 3.2 ; i = 4 ; Indirect operator
  • 5. 5 Pointer Declaration and Assignment ยง Pointer Variable โ€“ โ€œ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ(Pointer)โ€๋ฅผ ๊ฐ’์„ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜ char ch = โ€˜aโ€™ ; float f = 3.2 ; int i = 4 ; char *pch ; float *pf ; int *pi ; pch = &ch ; pf = &f ; pi = &i ; printf( โ€œ%d %d %dnโ€, pch, pf, pi ) ; data_type * pointer_varaible; char ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋งŒ์„ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜ float ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋งŒ์„ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜ int ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋งŒ์„ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜ char *pch = &ch ; float *pf = &f ; int *pi = &i ;
  • 6. 6 Pointer Declaration and Assignment ยง Pointer Variable char ch ; float f ; int i ; ch = โ€˜aโ€™ ; f = 3.2 ; i = 4 ; char ch ; float f ; int i ; char *pch = &ch ; float *pf = &f ; int *pi = &i ; *pch = โ€˜aโ€™ ; *pf = 3.2 ; *pi = 4 ; โ€ฆ 1000 โ€˜aโ€™ 1001 3.2 1005 4 โ€ฆ
  • 7. 7 Pointer Declaration and Assignment ยง Pointer Variable โ€“ ๋ชจ๋“  pointer ๋ณ€์ˆ˜๋Š” 4 bytes ํฌ๊ธฐ์ด๋‹ค (4 bytes machine) โ€ข why?? char *pch ; float *pf ; int *pi ; printf( โ€œ%dnโ€, sizeof(pch) ) ; printf( โ€œ%dnโ€, sizeof(pf) ) ; printf( โ€œ%dnโ€, sizeof(pi) ) ; int i = 0 ; int *pi = & i; printf( โ€œ%dnโ€, i ) ; printf( โ€œ%dnโ€, *pi ) ; printf( โ€œ%dnโ€, &pi ) ;
  • 8. 8 Pointer Declaration and Assignment ยง Pointer Variable โ€“ ๋ชจ๋“  pointer ๋ณ€์ˆ˜๋„ ๋ณ€์ˆ˜์ด๋ฏ€๋กœ ์ฃผ์†Œ๋ฅผ ๊ฐ–๋Š”๋‹ค. int i = 0 ; int *pi = &i; printf( โ€œ%dnโ€, i ) ; printf( โ€œ%dnโ€, *pi ) ; printf( โ€œ%dnโ€, &pi ) ; 1000 โ€ฆ 1020 โ€ฆ pi, 4 bytes i, 4 bytes
  • 9. 9 Pointer Declaration and Assignment [Ex] int *p; int month=3; p = &month; pointer variable p์— month์˜ memory address๋ฅผ assign p month 3 p 1000 month 31000 ์ฃผ์†Œ๋ฅผ ์ง์ ‘ ์ ๋Š” ๊ฒƒ๋ณด๋‹ค๋Š” ํ™”์‚ดํ‘œ๋ฅผ ์ด์šฉํ•˜์—ฌ ํ‘œ์‹œํ•œ๋‹ค. ยง Example
  • 10. 10 Addressing and Dereferencing [Ex] int a, b; int *p; a = 7; b = 7; p = &a; printf(โ€œ*p = %dnโ€, *p); *p = 3; printf(โ€œa = %dnโ€, a); p๋Š” a๋ฅผ pointingํ•˜๋ฏ€๋กœ, *p == 7 p๋Š” a์˜ address๋ฅผ ์ €์žฅํ•˜๊ณ  ์žˆ์œผ๋ฏ€๋กœ, *p๋Š” a๋ฅผ ์˜๋ฏธํ•˜๊ณ , ๊ฒฐ๊ตญ a์˜ ๋‚ด์šฉ์„ 3์œผ๋กœ ๋ณ€๊ฒฝ p์— a์˜ memory address๋ฅผ assign *p = 7 a = 3 ยง Example
  • 11. 11 Addressing and Dereferencing [Ex1] int a, b; int *p; a = b = 7; p = &a; *p = 3; p = &b; *p = 2 * *p โ€“ a; pa 7 b 7 p 3 a b 7 pa 3 11 b ยง Example
  • 12. 12 Addressing and Dereferencing [Ex1] int x, *p; x = 10; *p = x; [Ex3] int x, *p; x = 10; p = x; Error!! p์˜ ๊ฐ’์ด ์ฃผ์–ด์ง€์ง€ ์•Š์•„ p๊ฐ€ ์–ด๋Š ๊ณณ์„ referํ•˜๊ณ  ์žˆ๋Š”์ง€๋ฅผ ๋ชจ๋ฅด๋Š” ์ƒํ™ฉ์—์„œ p๊ฐ€ pointํ•˜๋Š” ๊ณณ์— x๊ฐ’ ์ž…๋ ฅ ๋ถˆ๊ฐ€ Error!! p๋Š” address๋ฅผ ๊ฐ’์œผ๋กœ ํ•˜๋Š” point variable์ด๋ฏ€๋กœ int์˜ assign์€ ๋ถˆ๊ฐ€ ยง ํ•˜๊ธฐ ์‰ฌ์šด ์—๋Ÿฌ
  • 13. 13 const ์™€ Pointer ๋ณ€์ˆ˜ ยง const ์™€ Pointer ๋ณ€์ˆ˜ โ€“ p๋Š” const int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜ โ€“ a๋Š” ์ƒ์ˆ˜๋ณ€์ˆ˜๋กœ ๊ฐ’์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์—†์Œ. โ€“ p๊ฐ€ ๊ฐ€๋ฅดํ‚ค๋Š” ๋ณ€์ˆ˜๋Š” ์ƒ์ˆ˜๋ณ€์ˆ˜์ด๋ฏ€๋กœ p๋ฅผ ํ†ตํ•œ ๋ณ€๊ฒฝ๋ถˆ๊ฐ€ const int a = 7; const int *p = &a; // ๊ฐ€๋Šฅ a = 8 ; //๋ถˆ๊ฐ€๋Šฅ *p = 9 ; //๋ถˆ๊ฐ€๋Šฅ
  • 14. 14 const ์™€ Pointer ๋ณ€์ˆ˜ ยง const ์™€ Pointer ๋ณ€์ˆ˜ โ€“ p๋Š” const int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์ด ์ง€๋งŒ, ์ผ๋ฐ˜ int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ์Œ. โ€“ a๋Š” ์ผ๋ฐ˜ ๋ณ€์ˆ˜๋กœ ๊ฐ’์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์Œ. โ€“ p๊ฐ€ ๊ฐ€๋ฅดํ‚ค๋Š” ๋ณ€์ˆ˜๊ฐ€ ์ผ๋ฐ˜๋ณ€์ˆ˜์ด๊ธฐ๋Š” ํ•˜๋‚˜, p๊ฐ€ const int์˜ ํฌ ์ธํ„ฐ๋กœ ์„ ์–ธ๋˜์—ˆ์œผ๋ฏ€๋กœ, p๋ฅผ ํ†ตํ•œ ๋ณ€๊ฒฝ๋ถˆ๊ฐ€ int a = 7; const int *p = &a; // ๊ฐ€๋Šฅ a = 8 ; //๊ฐ€๋Šฅ *p = 9 ; //๋ถˆ๊ฐ€๋Šฅ
  • 15. 15 const ์™€ Pointer ๋ณ€์ˆ˜ ยง const ์™€ Pointer ๋ณ€์ˆ˜ โ€“ p๋Š” ์ผ๋ฐ˜ int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์ด๋ฏ€ ๋กœ, ์ƒ์ˆ˜๋ณ€์ˆ˜ a์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์—†์Œ. โ€“ ๋งŒ์•ฝ ์ด๊ฒƒ์ด ๋œ๋‹ค๋ฉด *p=8 ์ด ๊ฐ€๋Šฅํ•˜๊ณ  ๊ฒฐ๊ตญ a์˜ ๊ฐ’์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๊ฒŒ ๋จ. const int a = 7; int *p = &a; // ๋ถˆ๊ฐ€๋Šฅ
  • 16. 16 const ์™€ Pointer ๋ณ€์ˆ˜ ยง const ์™€ Pointer ๋ณ€์ˆ˜ โ€“ p๋Š” const int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์ด ๋ฏ€๋กœ ๋ชจ๋‘ ๊ฐ€๋Šฅ โ€“ p๋Š” const int ํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•˜๋Š” ์ƒ์ˆ˜ ๋ณ€์ˆ˜์ด๋ฏ€๋กœ, ์ฒซ ์ดˆ๊ธฐํ™”๋Š” ๊ฐ€๋Šฅํ•˜์ง€๋งŒ, ๊ทธ ์ดํ›„ ์น˜ํ™˜์€ ๋ถˆ๊ฐ€๋Šฅ const int a = 7, b = 8 ; const int * p = &a; // ๊ฐ€๋Šฅ p = &b; //๊ฐ€๋Šฅ const int a = 7, b = 8 ; const int * const p = &a; // ๊ฐ€๋Šฅ p = &b; // ๋ถˆ๊ฐ€๋Šฅ
  • 17. 17 ๋‹ค์ค‘ Pointer ๋ณ€์ˆ˜ ยง ๋‹ค์ค‘ Pointer ๋ณ€์ˆ˜ โ€“ i๋Š” intํ˜• ๋ณ€์ˆ˜ โ€“ p๋Š” intํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜ โ€“ q๋Š” intํ˜• ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•˜๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅ ํ•  ์ˆ˜ ์žˆ๋Š” ํฌ์ธํ„ฐ ๋ณ€์ˆ˜ โ€ข q๋„ ํฌ์ธํ„ฐ๋ณ€์ˆ˜์ด๊ธฐ ๋•Œ๋ฌธ์— ํฌ๊ธฐ๋Š” 4๋ฐ”์ดํŠธ์ด๋‹ค(4 bytes machine) int i = 4 ; int *p ; int **q ;
  • 18. ยง Example 18 Pointer Declaration and Assignment [Ex] int i = 3; int *p ; int **q ; p = &i ; q = &p ; p i 3 i 31000 p 10002000 q 20003000 q
  • 19. ยง Example: โ€“ ๊ฐ ๋‹จ๊ณ„์˜ ๋ฉ”๋ชจ๋ฆฌ ์ƒํƒœ๋ฅผ ๊ทธ๋ฆผ์œผ ๋กœ ๊ทธ๋ฆฌ์‹œ์˜ค. โ€“ ์ตœ์ข…์ ์œผ๋กœ, i, j ๋ณ€์ˆ˜์˜ ๊ฐ’์€ ์–ผ๋งˆ ์ธ๊ฐ€? โ€“ i, j, p, q์˜ ์ฃผ์†Œ๋ฅผ ๊ฐ๊ฐ 1000, 1004, 2000, 3000 ์ด๋ผ๋ฉด, p, q, r ์˜ ๊ฐ’์€ ๊ฐ๊ฐ ์–ผ๋งˆ์ธ๊ฐ€? 19 Pointer Declaration and Assignment [Ex] int i = 3, j = 2; int *p, *q ; int **r ; p = &i ; q = &j ; r = &p ; *p = 4 ; *q = 5 ; **r = 6 ; *r = &q ; q =&i ; **r = 7 ;