Fortran_Nested_Arrays?
Fortran_Nested_Arrays?
(OP)
Hello,
Can anyone teach me how to declare an allocatable array with another array (TYPE) nested inside? Or suggest better way to store data below?
I wish to store data into an array like...
Automaker (i) % Month (j) % SALES(j)
Automaker (i) % Month (j) % COST(j)
ex)
Automaker (bmw) % Month(JAN) % Sales(JAN)
Automaker (bmw) % Month(JAN) % COST(JAN)
Automaker (bmw) % Month(FEB) % Sales(FEB)
Automaker (bmw) % Month(FEB) % COST(FEB)
;;
Automaker (Audi) % Month(JAN) % Sales(JAN)
Automaker (Audi) % Month(FEB) % Sales(FEB)
I used to declare
Type Month
integer sales , cost
End type
then
Type (month), dimension (:), allocatable :: Array1
for the inner array that I use.
Thank you,
Can anyone teach me how to declare an allocatable array with another array (TYPE) nested inside? Or suggest better way to store data below?
I wish to store data into an array like...
Automaker (i) % Month (j) % SALES(j)
Automaker (i) % Month (j) % COST(j)
ex)
Automaker (bmw) % Month(JAN) % Sales(JAN)
Automaker (bmw) % Month(JAN) % COST(JAN)
Automaker (bmw) % Month(FEB) % Sales(FEB)
Automaker (bmw) % Month(FEB) % COST(FEB)
;;
Automaker (Audi) % Month(JAN) % Sales(JAN)
Automaker (Audi) % Month(FEB) % Sales(FEB)
I used to declare
Type Month
integer sales , cost
End type
then
Type (month), dimension (:), allocatable :: Array1
for the inner array that I use.
Thank you,
RE: Fortran_Nested_Arrays?
CODE