Private Variables

0 views
Skip to first unread message

PGK

unread,
Nov 17, 2009, 4:47:20 AM11/17/09
to gg95
Here's a silly wee puzzle. The solution is below. Why is there no
error produced from the assignment of 11 to y?

module m
integer, private :: y
end module m

program p
use m
y = 11
end program p


















Module m's variable "y" is indeed private; the y being assigned 11, is
an implicit variable. Use "implicit none" to obtain a compiler error:

module m
integer, private :: y
end module m

program p
use m
implicit none
y = 11
end program p
Reply all
Reply to author
Forward
0 new messages