1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
module common_stuff
implicit none
! Variables du module:
integer :: taille
real(kind=8),dimension(:),allocatable :: tableau
contains
subroutine ini_tableau
implicit none
! variable locale
integer :: i
write(*,*) 'Taille du tableau?'
read(*,*) taille
! Allocation du tableau + initialisation des elements
allocate(tableau(taille))
do i=1,taille
tableau(i)=i
enddo
end subroutine ini_tableau
end module common_stuff
!!!!!!!!!!!!!!!!!!!!!!!!
program share_data
use common_stuff
implicit none
! variables locales
integer :: i
! initialisation
call ini_tableau
do i=1,taille
write(*,'(a9,i2,a2,g15.5)')'tableau(',i,')=',tableau(i)
enddo
! NB: 'taille' et 'tableau sont connu grace au 'use common_stuff'
end program share_data |
Partager