operation on module arguments



Hi there,

I have a question about how I can update the variables declared on a
module by simply having the USE statement only. To illustrate, for
example

file foo.f90
--------------
module foo
implicite none
real :: a, b, c

**** (anything I need here to make c=a+b)

end module foo
=========================
file main.f90
----------------
program main
use foo
implicit none
a= 1.0
b= 9.0
write(*,*) c
end program
=========================

The point is, I want c always to be the sum of a and b. In the main
program, a and b may be read in from an external file, (in the example
above, they get explicitly set.) What I want is, when a and b get
changed, c is automatically updated, I don't have to call another
subgrogram to update c. All I would like to have is just the 'use foo'
statement in the main program.

In the above example, if I don't want to change anything in the main
program, what I should write in the module foo to get the correct
result, c=10.0 ?

I apologize if this is a silly question. Thanks for any help.

.