Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a subroutine calling another subroutine



Hello...

A fortran90 newbie question.
I am having trouble calling a subroutine from within another subroutine.

Please refer to the following code.

Any help would be greatly appreciated!

Thanks,

Sang

PS. ntypes just declare length of DP like this... "INTEGER, PARAMETER :: DP = KIND(1.0D0)"

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

subroutine printa( linea )

  USE ntypes

  implicit none

  REAL(DP),DIMENSION(:) :: linea

  write(*,*) linea

end subroutine printa

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

subroutine printb( lineb )

  USE ntypes

  implicit none

  REAL(DP), DIMENSION(:) :: lineb

  lineb = (/ 20.0_DP, 30.0_DP, 40.0_DP /)
  write(*,*) lineb
  call printa(lineb)

end subroutine printb

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

program main

  USE ntypes

  REAL(DP), DIMENSION(3) :: arrg = (/ 2.0_DP, 3.0_DP, 4.0_DP /)

  interface
     subroutine printa(array)
       use ntypes
       REAL(DP), DIMENSION(:) :: array
     end subroutine printa
  end interface

  interface
     subroutine printb(array)
       use ntypes
       REAL(DP), DIMENSION(:) :: array
     end subroutine printb
  end interface

  write(*,*) arrg
  call printa(arrg)
  call printb(arrg)

end program main

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Fortran-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/fortran-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.