How do I access last item in an array in Fortran? How do I access last item in an array in Fortran? arrays arrays

How do I access last item in an array in Fortran?


array ( ubound (array) )

size will only work if the array is 1-indexed.


there is no such convenience notation, you need to do this

 array(size(array))

in older fortran versions you dont even have size() and need to track the dimension yourself

worth a note fortran arrays can be defined to have negative indices, so the end notation used in some other languages would be ambiguous