views:

379

answers:

1

how do I read from an array into a user defined variable... in Fortran?

A: 

From the question title, you want to "read" an item from an array of 15-character items to a scaler of 15 characters? Obviously only one array element will fit into the scaler. This isn't a "read" as in I/O -- just a copy, which can be done with an "equal" sign. Or do I misunderstand the question?

program test

character (len=5), dimension (1:4) :: char_array = (/ "12345", "abcde", "qwert", "YUIOP" /)

character (len=5) :: char_scaler

char_scaler = char_array (2)

write (*, *) char_scaler

stop

end program test

M. S. B.