0
我看到this post關於製作一個破舊的數組。語法訪問一個衣衫襤褸的數組?
當我試圖做一切工作,直到我想訪問這個數組。
type :: vector
integer, dimension(:), allocatable :: elements
end type vector
type :: ragged_array
type(vector), dimension(:), allocatable :: vectors
end type ragged_array
type(ragged_array) :: ragarr
allocate(ragarr%vectors(1)%elements(3))
allocate(ragarr%vectors(2)%elements(4))
!PROBLEM HERE :
raggar(1,1:3)=0
raggar(2,1:4)=1
它給我的錯誤:
The assigment operation or the binary expression operation is invalid for the data type of two operands
目前還不清楚,我如何操縱這個衣衫襤褸的數組,如何訪問一個特定的值...感謝您的幫助!
有沒有辦法讓整個'raggar'通過子程序的參數傳遞它?這似乎是做'raggar%矢量%元素'不起作用.... – Dadep