main
| Line | |
|---|
| 1 | ! This is like common_short.f, but the common block
|
|---|
| 2 | ! has a name here. In this case, it is illegal to use
|
|---|
| 3 | ! only parts of the common block (i.e. leave some
|
|---|
| 4 | ! variables undeclared in SUB, in this case, PAD3)
|
|---|
| 5 | PROGRAM MAIN
|
|---|
| 6 | REAL X
|
|---|
| 7 | X = 1.0
|
|---|
| 8 | CALL SUB(X,1)
|
|---|
| 9 | CALL SUB(X,2)
|
|---|
| 10 | WRITE(*,*) X
|
|---|
| 11 | END
|
|---|
| 12 |
|
|---|
| 13 | SUBROUTINE SUB(X,FLAG)
|
|---|
| 14 | INTEGER FLAG
|
|---|
| 15 | REAL X
|
|---|
| 16 | COMMON /MC/ Y
|
|---|
| 17 | IF(FLAG .eq. 1) THEN
|
|---|
| 18 | Y = X * 2
|
|---|
| 19 | ELSE
|
|---|
| 20 | X = Y
|
|---|
| 21 | ENDIF
|
|---|
| 22 | END
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.