Bonjour,
pourriez-vous m'aider pour récupérer dans une subroutine une variable allouée dans le programme principal ? J'arrive à utiliser common/ess/a pour une variable non allouée uniquement (cf exemple)
Merci d'avance!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 c234567 program essai implicit none integer n_alloc ! real, allocatable :: a(:) real a(4) common/ess/a ! n_alloc=4 ! allocate(a(n_alloc)) ! a(1:n_alloc)=0 a(2)=42 ! call s3(n_alloc) call s3 pause end subroutine s3 ! subroutine s3(n_alloc) !integer n_alloc !real a(n_alloc) real a(4) common/ess/a write(6,100)(a) 100 format(e15.5) end subroutine s3
Partager