Ayyy LMAO
unread,Nov 4, 2015, 10:47:08 PM11/4/15You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hello everyone,
I'd like to dinamically set both the extent and length of a one dimensional array of characters.
The following code, however, is not working as intended and returns, for any position in the array, just the last value entered. Here is the code:
PROGRAM hello
IMPLICIT NONE
CHARACTER(LEN=:),DIMENSION(:),ALLOCATABLE :: array_lineas
INTEGER :: largo , cant_lineas , i
WRITE(*,*) ' Escriba un numero para el largo de cada linea'
READ(*,*) largo
WRITE(*,*) ' Escriba la cantidad de lineas'
READ(*,*) cant_lineas
ALLOCATE(CHARACTER(LEN=largo) :: array_lineas(cant_lineas))
WRITE(*,*) 'Escriba el array'
READ(*,*) (array_lineas(i),i=1,cant_lineas)
WRITE(*,*) 'Array guardado: '
DO i=1,cant_lineas
WRITE(*,*) array_lineas(i)
ENDDO
READ(*,*)
END PROGRAM
So my question is, is the above syntax for the allocation incorrect, or is that feature not supported by the compiler ? I'm using gfortran 5.2.0 on windows 7
Thank you
Francisco.