Many people are surprised when you say, you can do type definition, pointers and dynamic memory allocation in Fortran. These are in Fortran since the time Fortran 90 was released, 15+ years back. Now Fortran 2003 has all features of object oriented programming language.
But here i present an example of linked list in Fortran 90.
If you study the example carefully, you will learn 3 new concepts in Fortran.
- Type definition.
- Dynamic memory allocation.
No body thinks of these and Fortran in the same breadth but they are very much part of Fortran.
real (kind=8) :: x,y,z
type(node),pointer :: next
type(node),pointer :: list, first
integer :: iunit,icnt
real(kind =8),allocatable :: eudis(:)
first => list
list => first
print *, icnt , eudis(icnt)
list => list%next