2013년 9월 10일 화요일

배열

From Evernote:

배열

배열은 동일한 자료형을 가진 변수들의 집합이다. 배열은 1차원 배열부터 7차원 배열까지 선언할 수 있으며, 배열을 선언할 때에는 dimension 키워드를 사용한다.

real, dimension(5) :: vector ! 5개의 요소를 가진 실수형 1차원 배열
integer, dimension (3, 3) :: matrix ! 정수형 2차원 배열

각 배열의 요소는 첨자를 통해서 참조할 수 있는데, vector 배열의 첫 번째 요소는 vector(1) 이다. 마찬가지로 2차원 배열인 matrix 배열의 요소는  matrix(1,1), matrix (2,1), matrix (3,1), matrix (1,2), ..., matrix(3,3) 이다.


배열의 첨자 범위를 직접 지정할 수도 있다.

real, dimension (1:5) :: vector
real, dimension (-10:8) :: a1 ! 19개의 요소를 가진 1차원 배열
integer, dimension (-3:3, -20:0, 1:2, 6, 2, 5:6, 2) :: grid1 ! 7차원 배열

grid1 배열의 요소의 갯수는 7 * 21 * 2 * 6 * 2 * 2 = 14112개 이다.


컴파일러의 종류에 따라 7차원 이상의 배열을 사용할 수 있기도 하지만, 표준에 따르면 최대 7차원 배열까지만 선언할 수 있다.


댓글 1개:

  1. If the problem stays, the web on line casino ought to contact the financial institution immediately. Since such conditions can resemble fraud, it's all the time better to have a particular support team that can deal with players and repair 바카라 사이트 sort of|this kind of|this type of} drawback. Individuals who expressed interest in participating had been emailed a link to an data sheet and consent type, which included contact particulars for help companies. Those who consented had been then phoned to verify eligibility and arrange an interview time. One researcher conducted telephone interviews with non-treatment-seekers, and one provisionally registered psychologist conducted telephone interviews with treatment-seekers.

    답글삭제