! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 6.31. Pointer as a derived type component.
  program G31
    use Element_M
    use G31M
    implicit none
    type (Box_Type), target :: Box  ! Type declarations
    type (Box_Type), pointer :: Root_BP
! start program G31_F90
    Box % El = Chem_El_Type_2( "Carbon", "C", 6.0, 12.0, Isotope_Type( 5, 1.0 ) )
    allocate( Box % Next_BP )
    Box % Next_BP % El = Chem_El_Type_2( "LINOLEUM", "Lo", 20.0, 999.9, Isotope_Type( 2, 0.1 ) )
    nullify( Box % Next_BP % Next_BP )
    allocate( Root_BP )
    Root_BP % El = Chem_El_Type_2( "Helium", "He", 2.0, 4.0, Isotope_Type( 2, 1.0 ) )
    Root_BP % Next_BP => Box
    call Print_List( Root_BP )
    stop
  end program G31
