RosettaCodeData/Task/Singly-linked-list-Element-insertion/Fortran/singly-linked-list-element-insertion.f
2023-07-01 13:44:08 -04:00

10 lines
307 B
Forth

elemental subroutine addAfter(nodeBefore,value)
type (node), intent(inout) :: nodeBefore
real, intent(in) :: value
type (node), pointer :: newNode
allocate(newNode)
newNode%data = value
newNode%next => nodeBefore%next
nodeBefore%next => newNode
end subroutine addAfter