append Subroutine

public subroutine append(lst, data)

Arguments

Type IntentOptional Attributes Name
type(llist), intent(inout) :: lst
character, intent(in) :: data

Contents

Source Code


Source Code

    subroutine append(lst, data)
      type(llist), intent(inout) :: lst
      character(*), intent(in)    :: data
      if (.not. associated(lst%begin)) then
         allocate(lst%begin)
         lst%begin%data = data
         lst%end => lst%begin
      else
         allocate(lst%end%next)
         lst%end%next%data = data
         lst%end => lst%end%next
      end if
    end subroutine append