fortran - Fortran77 define array with integer variables in first column and string variables in the second -


how define array integer variables in first column , string variables in second?

for example: array melf ideally have numbers in first , third columns , strings in third. have working integers want mix different types of variables. possible?

  integer, save :: melf(11000, 11000, 11000)   data melf/11000*11000*11000*0/ 

no, not possible mix types of elements of array in fortran77, or more recent edition of language either. in array elements must of same type (and kind).

in modern fortran, ie 90 , later, can define derived type such as;

type my_type   integer :: col1, col3   character(len=16) :: col2 end type 

and declare array such as

type(my_type), dimension(:), allocatable :: my_array 

and have data structure can slice expressions such as

my_array % col2  my_array(1:12) % col1  my_array(2:6) % col2(5:8) 

and forth.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -