SlideShare a Scribd company logo
1 of 24
최원빈 (bindon@korea.ac.kr)
고려대학교
2017. 05. 17.
C 프로그래밍 이론 및 실습
2
지난 과제 풀이
3
지난 과제 풀이
int temp 0x004FF8A4 0x0a000000
undefined local variable
(only debug mode)
0x004FF8A8 0xcccccccc
swap() SFP 0x004FF8AC 0xa0f94f00
swap() RET 0x004FF8B0 0xb9170301
swap() first parameter 0x004FF8B4
0x0a000000
0x14000000
swap() second parameter 0x004FF8B8
0x14000000
0x0a000000
...
undefined local variable
(only debug mode)
0x004FF988 0xcccccccc
int val2 = 20; 0x004FF98C 0x14000000
undefined local variable
(only debug mode)
0x004FF994 0xcccccccc
undefined local variable
(only debug mode)
0x004FF994 0xcccccccc
int val1 = 10; 0x004FF998 0x0a000000
undefined local variable
(only debug mode)
0x004FF99C 0xcccccccc
4
지난 과제 풀이
5
지난 과제 풀이
int temp 0x0133f78c 0x0a000000
undefined local variable
(only debug mode)
0x0133f790 0xcccccccc
swap() SFP 0x0133f794 0x8cf83301
swap() RET 0x0133f798 0xe316ed00
swap() first parameter 0x0133f79c 0x80f83301
swap() second parameter 0x133f7a0 0x74f83301
...
undefined local variable
(only debug mode)
0x0133f870 0xcccccccc
int val2 = 20; 0x0133f874
0x14000000
0x0a000000
undefined local variable
(only debug mode)
0x0133f878 0xcccccccc
undefined local variable
(only debug mode)
0x0133f87c 0xcccccccc
int val1 = 10; 0x0133f880
0x0a000000
0x14000000
undefined local variable
(only debug mode)
0x0133f884 0xcccccccc
6
포인터와 함수에 대한 이해
7
포인터와 함수에 대한 이해
 scanf() 함수 호출 시 &를 붙이는 이유
 scanf()를 만들 때 format에 해당하는 주소 값
을 받기로 정의했기 때문
 파라미터의 값이 포인터 형태
8
포인터와 함수에 대한 이해
 printf() 함수의 경우
 매개변수로 들어가는 파라미터들이 포인터가
아님
9
다차원 배열
 2차원 배열의 이해
 기본적인 책에서 설명하는 예제들
 int arr[3][4];
 3행 4열의 배열 생성
? ? ? ?
? ? ? ?
? ? ? ?
10
다차원 배열
 2차원 배열의 이해
 기본적인 책에서 설명하는 예제들
11
다차원 배열
 2차원 배열의 이해
 기본적인 책에서 설명하는 예제들
1 2 3 4
5 6 7 8
9 10 11 12
12
다차원 배열
 2차원 배열의 이해
 실제 적재되는 메모리 주소
1
2
3
4
5
6
7
8
9
10
11
12
13
다차원 배열
 2차원 배열의 이해
 2행 4열의 값 변경
1 2 3 4
5 6 7 8
9 10 11 12
1 2 3 4
5 6 7 99
9 10 11 12
14
다차원 배열
 2차원 배열의 이해
 2행 4열의 값 변경
 가장 기본적인 방법
 arr[1][3]
1 2 3 4
5 6 7 99
9 10 11 12
15
다차원 배열
 2차원 배열의 이해
 2행 4열의 값 변경
 배열 연산자 특성을 이용한 표현 방식 변경
 arr[1][3] == *(arr[1]+3)
1 2 3 4
5 6 7 99
9 10 11 12
16
다차원 배열
 2차원 배열의 이해
 2행 4열의 값 변경
 실제 저장 방식을 이용한 1차원 배열 접근
1 2 3 4 5 6 7 99 9 10 11 12
17
다차원 배열
 2차원 배열의 이해(implementation convention)
 다음 코드에 대한 명령 수행 flow
 int arr[3] = {1, 2, 3};
int idx;
for(idx=0; idx<sizeof(arr)/sizeof(len); idx++) {
printf("%dn", arr[idx]);
}
18
다차원 배열
 2차원 배열의 이해(implementation convention)
 다음 코드에 대한 명령 수행 flow
 definition : 2번
 for문(5n + 1 = 16번)
 idx = 0 : 1번
 idx<sizeof(arr)/sizeof(len) : 4번 * n번
 sizeof(), 나누기, 비교
 idx++ : 1번 * n번
 총 18번의 명령 수행
19
다차원 배열
 2차원 배열의 이해(implementation convention)
 다음 코드에 대한 명령 수행 flow
 int arr[3] = {1, 2, 3};
int idx;
int len;
for(idx=0, len=sizeof(arr)/sizeof(len); idx<len; idx++) {
printf("%dn", arr[idx]);
}
20
다차원 배열
 2차원 배열의 이해(implementation convention)
 다음 코드에 대한 명령 수행 flow
 definition : 3번, len 추가
 for문(2n + 4 = 10번)
 idx = 0 : 1번
len = sizeof(arr)/sizeof(len) : 4번
 sizeof(), 나누기, 대입
 idx<len : 1번 * n번
 idx++ : 1번 * n번
 총 13번의 명령 수행
21
포인터의 포인터
 n중 포인터
 싱글 포인터, 더블 포인터, 트리플 포인터?
 4중? 5중? 6중? n중?
 포인터는 그냥 포인터 일뿐
cdef
a 10
a 10b
a 10b
싱글
더블
?
22
포인터의 포인터
 n중 포인터
cdef a 10b
23
포인터의 포인터
 n중 포인터
cdef a 10b
24
Thank you

More Related Content

What's hot

Startup JavaScript 6 - 함수, 스코프, 클로저
Startup JavaScript 6 - 함수, 스코프, 클로저Startup JavaScript 6 - 함수, 스코프, 클로저
Startup JavaScript 6 - 함수, 스코프, 클로저Circulus
 
R 프로그래밍 기본 문법
R 프로그래밍 기본 문법R 프로그래밍 기본 문법
R 프로그래밍 기본 문법Terry Cho
 
Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Circulus
 
알고리즘과 자료구조
알고리즘과 자료구조알고리즘과 자료구조
알고리즘과 자료구조영기 김
 
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기Chris Ohk
 
[KOSSA] C++ Programming - 13th Study - exception handling
[KOSSA] C++ Programming - 13th Study - exception handling[KOSSA] C++ Programming - 13th Study - exception handling
[KOSSA] C++ Programming - 13th Study - exception handlingSeok-joon Yun
 
Higher order procedure2 with conventional interface
Higher order procedure2 with conventional interface Higher order procedure2 with conventional interface
Higher order procedure2 with conventional interface fromitive
 
7가지 동시성 모델 - 3장. 함수형 프로그래밍
7가지 동시성 모델 - 3장. 함수형 프로그래밍7가지 동시성 모델 - 3장. 함수형 프로그래밍
7가지 동시성 모델 - 3장. 함수형 프로그래밍Hyunsoo Jung
 
7가지 동시성 모델 4장
7가지 동시성 모델 4장7가지 동시성 모델 4장
7가지 동시성 모델 4장HyeonSeok Choi
 
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...Seok-joon Yun
 
R 기본-데이타형 소개
R 기본-데이타형 소개R 기본-데이타형 소개
R 기본-데이타형 소개Terry Cho
 
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...Seok-joon Yun
 
Unity Surface Shader for Artist 04
Unity Surface Shader for Artist 04Unity Surface Shader for Artist 04
Unity Surface Shader for Artist 04SangYun Yi
 
2021 2학기 정기 세미나 5주차
2021 2학기 정기 세미나 5주차2021 2학기 정기 세미나 5주차
2021 2학기 정기 세미나 5주차Moonki Choi
 

What's hot (20)

문자함수(1)
문자함수(1)문자함수(1)
문자함수(1)
 
문자함수(2)
문자함수(2)문자함수(2)
문자함수(2)
 
javascript02
javascript02javascript02
javascript02
 
Startup JavaScript 6 - 함수, 스코프, 클로저
Startup JavaScript 6 - 함수, 스코프, 클로저Startup JavaScript 6 - 함수, 스코프, 클로저
Startup JavaScript 6 - 함수, 스코프, 클로저
 
5. queue
5. queue5. queue
5. queue
 
R 프로그래밍 기본 문법
R 프로그래밍 기본 문법R 프로그래밍 기본 문법
R 프로그래밍 기본 문법
 
Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체
 
알고리즘과 자료구조
알고리즘과 자료구조알고리즘과 자료구조
알고리즘과 자료구조
 
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
 
4. stack
4. stack4. stack
4. stack
 
[KOSSA] C++ Programming - 13th Study - exception handling
[KOSSA] C++ Programming - 13th Study - exception handling[KOSSA] C++ Programming - 13th Study - exception handling
[KOSSA] C++ Programming - 13th Study - exception handling
 
Higher order procedure2 with conventional interface
Higher order procedure2 with conventional interface Higher order procedure2 with conventional interface
Higher order procedure2 with conventional interface
 
7가지 동시성 모델 - 3장. 함수형 프로그래밍
7가지 동시성 모델 - 3장. 함수형 프로그래밍7가지 동시성 모델 - 3장. 함수형 프로그래밍
7가지 동시성 모델 - 3장. 함수형 프로그래밍
 
7가지 동시성 모델 4장
7가지 동시성 모델 4장7가지 동시성 모델 4장
7가지 동시성 모델 4장
 
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
 
R 기본-데이타형 소개
R 기본-데이타형 소개R 기본-데이타형 소개
R 기본-데이타형 소개
 
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...
 
Unity Surface Shader for Artist 04
Unity Surface Shader for Artist 04Unity Surface Shader for Artist 04
Unity Surface Shader for Artist 04
 
2021 2학기 정기 세미나 5주차
2021 2학기 정기 세미나 5주차2021 2학기 정기 세미나 5주차
2021 2학기 정기 세미나 5주차
 
3. linked list
3. linked list3. linked list
3. linked list
 

Similar to [170517 5주차]C언어 A반

[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이GangSeok Lee
 
Deview 2019 눈발자국
Deview 2019 눈발자국Deview 2019 눈발자국
Deview 2019 눈발자국hanbeom Park
 
DEVIEW-FULL-감독판.pptx
DEVIEW-FULL-감독판.pptxDEVIEW-FULL-감독판.pptx
DEVIEW-FULL-감독판.pptxhanbeom Park
 
빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)SeongHyun Ahn
 
[0312 조진현] good bye dx9
[0312 조진현] good bye dx9[0312 조진현] good bye dx9
[0312 조진현] good bye dx9진현 조
 
[신경망기초] 선형회귀분석
[신경망기초] 선형회귀분석[신경망기초] 선형회귀분석
[신경망기초] 선형회귀분석jaypi Ko
 
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산S.O.P.T - Shout Our Passion Together
 
Function calling convention
Function calling conventionFunction calling convention
Function calling conventionYuk SeungChan
 
Java mentoring of samsung scsc 2
Java mentoring of samsung scsc   2Java mentoring of samsung scsc   2
Java mentoring of samsung scsc 2도현 김
 
C++ 프로그래밍 2014-2018년 기말시험 기출문제
C++ 프로그래밍 2014-2018년 기말시험 기출문제C++ 프로그래밍 2014-2018년 기말시험 기출문제
C++ 프로그래밍 2014-2018년 기말시험 기출문제Lee Sang-Ho
 
#아두이노 초급연수
#아두이노 초급연수#아두이노 초급연수
#아두이노 초급연수gongdigi24
 
[C++ Korea] Effective Modern C++ Study item14 16 +신촌
[C++ Korea] Effective Modern C++ Study item14 16 +신촌[C++ Korea] Effective Modern C++ Study item14 16 +신촌
[C++ Korea] Effective Modern C++ Study item14 16 +신촌Seok-joon Yun
 
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...GangSeok Lee
 
Python3 brief summary
Python3 brief summaryPython3 brief summary
Python3 brief summaryHoChul Shin
 
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14 불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14 명신 김
 
Python Programming: Function
Python Programming: FunctionPython Programming: Function
Python Programming: FunctionChan Shik Lim
 
Netmanias L2,L3 Training (3) L2, L3 QoS
Netmanias L2,L3 Training (3) L2, L3 QoSNetmanias L2,L3 Training (3) L2, L3 QoS
Netmanias L2,L3 Training (3) L2, L3 QoSChris Changmo Yoo
 

Similar to [170517 5주차]C언어 A반 (20)

[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
 
Ch11
Ch11Ch11
Ch11
 
Deview 2019 눈발자국
Deview 2019 눈발자국Deview 2019 눈발자국
Deview 2019 눈발자국
 
DEVIEW-FULL-감독판.pptx
DEVIEW-FULL-감독판.pptxDEVIEW-FULL-감독판.pptx
DEVIEW-FULL-감독판.pptx
 
빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)
 
강의자료 2
강의자료 2강의자료 2
강의자료 2
 
[0312 조진현] good bye dx9
[0312 조진현] good bye dx9[0312 조진현] good bye dx9
[0312 조진현] good bye dx9
 
[신경망기초] 선형회귀분석
[신경망기초] 선형회귀분석[신경망기초] 선형회귀분석
[신경망기초] 선형회귀분석
 
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
 
Function calling convention
Function calling conventionFunction calling convention
Function calling convention
 
Java mentoring of samsung scsc 2
Java mentoring of samsung scsc   2Java mentoring of samsung scsc   2
Java mentoring of samsung scsc 2
 
C++ 프로그래밍 2014-2018년 기말시험 기출문제
C++ 프로그래밍 2014-2018년 기말시험 기출문제C++ 프로그래밍 2014-2018년 기말시험 기출문제
C++ 프로그래밍 2014-2018년 기말시험 기출문제
 
#아두이노 초급연수
#아두이노 초급연수#아두이노 초급연수
#아두이노 초급연수
 
[C++ Korea] Effective Modern C++ Study item14 16 +신촌
[C++ Korea] Effective Modern C++ Study item14 16 +신촌[C++ Korea] Effective Modern C++ Study item14 16 +신촌
[C++ Korea] Effective Modern C++ Study item14 16 +신촌
 
Ch10
Ch10Ch10
Ch10
 
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
 
Python3 brief summary
Python3 brief summaryPython3 brief summary
Python3 brief summary
 
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14 불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
 
Python Programming: Function
Python Programming: FunctionPython Programming: Function
Python Programming: Function
 
Netmanias L2,L3 Training (3) L2, L3 QoS
Netmanias L2,L3 Training (3) L2, L3 QoSNetmanias L2,L3 Training (3) L2, L3 QoS
Netmanias L2,L3 Training (3) L2, L3 QoS
 

More from arundine

Cryptol 수업자료
Cryptol 수업자료Cryptol 수업자료
Cryptol 수업자료arundine
 
[170605 7주차]C언어 A반
[170605 7주차]C언어 A반[170605 7주차]C언어 A반
[170605 7주차]C언어 A반arundine
 
[170529 6주차]C언어 A반
[170529 6주차]C언어 A반[170529 6주차]C언어 A반
[170529 6주차]C언어 A반arundine
 
[170510 4주차]C언어 A반
[170510 4주차]C언어 A반[170510 4주차]C언어 A반
[170510 4주차]C언어 A반arundine
 
[170403 2주차]C언어 A반
[170403 2주차]C언어 A반[170403 2주차]C언어 A반
[170403 2주차]C언어 A반arundine
 
[170327 1주차]C언어 A반
[170327 1주차]C언어 A반[170327 1주차]C언어 A반
[170327 1주차]C언어 A반arundine
 

More from arundine (6)

Cryptol 수업자료
Cryptol 수업자료Cryptol 수업자료
Cryptol 수업자료
 
[170605 7주차]C언어 A반
[170605 7주차]C언어 A반[170605 7주차]C언어 A반
[170605 7주차]C언어 A반
 
[170529 6주차]C언어 A반
[170529 6주차]C언어 A반[170529 6주차]C언어 A반
[170529 6주차]C언어 A반
 
[170510 4주차]C언어 A반
[170510 4주차]C언어 A반[170510 4주차]C언어 A반
[170510 4주차]C언어 A반
 
[170403 2주차]C언어 A반
[170403 2주차]C언어 A반[170403 2주차]C언어 A반
[170403 2주차]C언어 A반
 
[170327 1주차]C언어 A반
[170327 1주차]C언어 A반[170327 1주차]C언어 A반
[170327 1주차]C언어 A반
 

[170517 5주차]C언어 A반

  • 1. 최원빈 (bindon@korea.ac.kr) 고려대학교 2017. 05. 17. C 프로그래밍 이론 및 실습
  • 3. 3 지난 과제 풀이 int temp 0x004FF8A4 0x0a000000 undefined local variable (only debug mode) 0x004FF8A8 0xcccccccc swap() SFP 0x004FF8AC 0xa0f94f00 swap() RET 0x004FF8B0 0xb9170301 swap() first parameter 0x004FF8B4 0x0a000000 0x14000000 swap() second parameter 0x004FF8B8 0x14000000 0x0a000000 ... undefined local variable (only debug mode) 0x004FF988 0xcccccccc int val2 = 20; 0x004FF98C 0x14000000 undefined local variable (only debug mode) 0x004FF994 0xcccccccc undefined local variable (only debug mode) 0x004FF994 0xcccccccc int val1 = 10; 0x004FF998 0x0a000000 undefined local variable (only debug mode) 0x004FF99C 0xcccccccc
  • 5. 5 지난 과제 풀이 int temp 0x0133f78c 0x0a000000 undefined local variable (only debug mode) 0x0133f790 0xcccccccc swap() SFP 0x0133f794 0x8cf83301 swap() RET 0x0133f798 0xe316ed00 swap() first parameter 0x0133f79c 0x80f83301 swap() second parameter 0x133f7a0 0x74f83301 ... undefined local variable (only debug mode) 0x0133f870 0xcccccccc int val2 = 20; 0x0133f874 0x14000000 0x0a000000 undefined local variable (only debug mode) 0x0133f878 0xcccccccc undefined local variable (only debug mode) 0x0133f87c 0xcccccccc int val1 = 10; 0x0133f880 0x0a000000 0x14000000 undefined local variable (only debug mode) 0x0133f884 0xcccccccc
  • 7. 7 포인터와 함수에 대한 이해  scanf() 함수 호출 시 &를 붙이는 이유  scanf()를 만들 때 format에 해당하는 주소 값 을 받기로 정의했기 때문  파라미터의 값이 포인터 형태
  • 8. 8 포인터와 함수에 대한 이해  printf() 함수의 경우  매개변수로 들어가는 파라미터들이 포인터가 아님
  • 9. 9 다차원 배열  2차원 배열의 이해  기본적인 책에서 설명하는 예제들  int arr[3][4];  3행 4열의 배열 생성 ? ? ? ? ? ? ? ? ? ? ? ?
  • 10. 10 다차원 배열  2차원 배열의 이해  기본적인 책에서 설명하는 예제들
  • 11. 11 다차원 배열  2차원 배열의 이해  기본적인 책에서 설명하는 예제들 1 2 3 4 5 6 7 8 9 10 11 12
  • 12. 12 다차원 배열  2차원 배열의 이해  실제 적재되는 메모리 주소 1 2 3 4 5 6 7 8 9 10 11 12
  • 13. 13 다차원 배열  2차원 배열의 이해  2행 4열의 값 변경 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 99 9 10 11 12
  • 14. 14 다차원 배열  2차원 배열의 이해  2행 4열의 값 변경  가장 기본적인 방법  arr[1][3] 1 2 3 4 5 6 7 99 9 10 11 12
  • 15. 15 다차원 배열  2차원 배열의 이해  2행 4열의 값 변경  배열 연산자 특성을 이용한 표현 방식 변경  arr[1][3] == *(arr[1]+3) 1 2 3 4 5 6 7 99 9 10 11 12
  • 16. 16 다차원 배열  2차원 배열의 이해  2행 4열의 값 변경  실제 저장 방식을 이용한 1차원 배열 접근 1 2 3 4 5 6 7 99 9 10 11 12
  • 17. 17 다차원 배열  2차원 배열의 이해(implementation convention)  다음 코드에 대한 명령 수행 flow  int arr[3] = {1, 2, 3}; int idx; for(idx=0; idx<sizeof(arr)/sizeof(len); idx++) { printf("%dn", arr[idx]); }
  • 18. 18 다차원 배열  2차원 배열의 이해(implementation convention)  다음 코드에 대한 명령 수행 flow  definition : 2번  for문(5n + 1 = 16번)  idx = 0 : 1번  idx<sizeof(arr)/sizeof(len) : 4번 * n번  sizeof(), 나누기, 비교  idx++ : 1번 * n번  총 18번의 명령 수행
  • 19. 19 다차원 배열  2차원 배열의 이해(implementation convention)  다음 코드에 대한 명령 수행 flow  int arr[3] = {1, 2, 3}; int idx; int len; for(idx=0, len=sizeof(arr)/sizeof(len); idx<len; idx++) { printf("%dn", arr[idx]); }
  • 20. 20 다차원 배열  2차원 배열의 이해(implementation convention)  다음 코드에 대한 명령 수행 flow  definition : 3번, len 추가  for문(2n + 4 = 10번)  idx = 0 : 1번 len = sizeof(arr)/sizeof(len) : 4번  sizeof(), 나누기, 대입  idx<len : 1번 * n번  idx++ : 1번 * n번  총 13번의 명령 수행
  • 21. 21 포인터의 포인터  n중 포인터  싱글 포인터, 더블 포인터, 트리플 포인터?  4중? 5중? 6중? n중?  포인터는 그냥 포인터 일뿐 cdef a 10 a 10b a 10b 싱글 더블 ?
  • 22. 22 포인터의 포인터  n중 포인터 cdef a 10b
  • 23. 23 포인터의 포인터  n중 포인터 cdef a 10b