user1543042
user1543042

Reputation: 3440

Fortran don't allow variable value to change

Is there any way to force a variable to be constant even if a subroutine (part of a standard library) tries to change it? Obviously intent(in) throws an error.

Upvotes: 0

Views: 337

Answers (1)

Pass a copy of the variable to the library.

Or pass to your subroutine by VALUE instead of INTENT(IN). It will be changed, but only inside your own subroutine.

Upvotes: 4

Related Questions