I'm trying to write a short F77 programme, which asks the user to type in the name of datapoint with its 10 values. The absolute number of data points (name+10values) should be variable.
Because Fortran doesn't accept mixed arrays, I'm trying to write a 1D array with the names and a 2D array with the values. However the 1D array does not seem to work and I don't know what I'm doing wrong.
implicit none
real x,
integer ndatapoints, i,j
character names(1,100)*10
dimension x(10,10)
do i= 1, ndatapoints
read(5,*) (names(i), i=1, ndatapoints),(x(i,j),j=1, 10)
end do
do i=1,ndatapoints
write(6,*)(x(i,j),j=1,10)
write(6,*)(names(i),i,ndatapoints)
end do
namesisn't declared as a rank-1 array, but a rank-2. But you then reference it as rank-1. So, what error do you get?