• 검색 결과가 없습니다.

[2011 04 14].Part2 Ch1.1차원배열이란무엇인가

N/A
N/A
Protected

Academic year: 2021

Share "[2011 04 14].Part2 Ch1.1차원배열이란무엇인가"

Copied!
12
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

컴퓨터공학실습 1

Part 2

Ch1. 1 차원 배열이란 무엇인가

2011-04-14

1

(2)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

목차

1 차원 배열이란

1 차원 배열의 주소와 값의 참조

(3)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열이란

배열이란 ?

같은 자료형을 가진 연속된 메모리 공간으로 이루어진 자료

구조

같은 자료형의 변수가 여러 개 필요할 때 사용

(char, int, double, etc.)

학생 성적 , 도서 목록 , 달력 등

(4)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열이란

배열의 선언

( 자료형 : 배열의 자료형 ,

배열 이름 : 배열의 이름 ,

[ 배열 길이 ]: 배열 요소의 총 길이 )

4

(5)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열이란

배열의 데이터 저장 / 참조

(6)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열이란

배열의 초기화

6

int array1[5] = {90,80,70,60,50};

int array2[ ] = {90,80,70,60,50};

int array3[5] = {90,80,70};

(7)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열이란

배열 선언 시 주의점

배열 요소는 0 부터 시작

배열 초기화를 중괄호로 할 경우 선언과 동시에 초기화

배열의 길이는 상수만 지정 가능 ( 변수로 지정 불가 )

7

(8)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열의 주소와 값의 참조

& 연산자는 주소를 참조하는 연산자이다

8

변수의 주소 표현

배열의 주소 표현

사용법 :

&

변수이름

사용법 :

&

배열 요소의 위치

int a=10, b=20;

printf(“

%x

\n”,

&a

);

// a

의 주

printf(“

%x

\n”,

&b

);

// b

의 주

int array[2] = {10, 20};

printf(“

%x

\n”,

&array[0]

);

// array[0]

주소

printf(“

%x

\n”,

&array[1]

);

// array[1]

주소

int

ar-ray1[3]

char

ar-ray2[3]

(9)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열의 주소와 값의 참조

배열의 이름은 배열의 시작 주소이다

(10)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열의 주소와 값의 참조

* 연산자는 메모리 공간에 저장된 값을 참조한다

10

변수의 값 참조

배열 요소의 값 참조

사용법 :

*

&

변수이름

사용법 :

*

&

배열 요소

int a=10, b=20;

printf(“

%d

\n”,

*&a

);

// a

printf(“

%d

\n”,

*&b

);

// b

의 값

int array[2] = {10, 20};

printf(“

%d

\n”,

*&array[0]

);

// array[0]

의 값

printf(“

%d

\n”,

*&array[1]

);

// array[1]

의 값

(11)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열의 주소와 값의 참조

(12)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

1 차원 배열의 주소와 값의 참조

요약

12

Int arr[3];

arr[0]

arr[1]

arr[2]

배열 요소

arr[0]

arr[1]

arr[2]

배열 요소의

주소

&arr[0]

&arr[1]

&arr[2]

배열 요소의

주소 다른 표현

arr ==

arr + 0

arr + 1

arr +2

배열 요소의 주소

를 이용한 참조

*&arr[0]

( == arr[0])

( == arr[1])

*&arr[1]

( == arr[2])

*&arr[2]

배열 요소의 주소

를 이용한 참조

다른 표현

*(arr + 0)

참조

관련 문서

따라서 x=1에서 연속이지만 미분가능하지 않은

Energy Intelligence, Petroleum Intelligence Weekly, December 11, 2011.. Energy Intelligence, Petroleum Intelligence Weekly,

 Polymers containing amide, ester, or urethane may be attacked by hot acids or alkalies, and hydrolyzed.. 

• Raoult’s law reveals that the vapor pressure of a component in an ideal solution is proportional to its mole fraction... • Some solutions depart significantly

Infinite Voltage Gain Very Large

• In a attraction-dominant condition, when a gas expands, some kinetic energy of them must be converted to potential energy to reach greater

School of Mechanical Systems Engineering Chonnam National University..

 캐리어 비교 방식 SVPWM 방법은 전압-시간 평균 이론에 바탕을 둔 SVPWM 방법의 특성을 그대로 가지면서 그 구현이 매우 간편하고 게이트에 실제로 인가되는