Silverfrost Forums

Welcome to our forums

FORTRAN ERROR

14 Dec 2012 5:50 #11295

[size=18:cac257152b]Hi 'Access violation' Anyone seen this error? It occurs when trying to call subroutine:[/size:cac257152b]

http://www.imagetoo.com/images/1214201290.jpg

21 Dec 2012 10:07 #11324

Quoted from PPPO [size=18:4b4943c1ce]Hi 'Access violation' Anyone seen this error? It occurs when trying to call subroutine:[/size:4b4943c1ce]

http://www.imagetoo.com/images/1214201290.jpg

I have no idea what is the answer to this question is, but want to learn more from this question. Is it possible to call subroutines only with their name without specifying their parameters?

21 Dec 2012 12:24 #11326

Yes it is. If the subroutine has no parameters, i.e. all data is passed to and from it by other means, such as comon, modules or files. If there are no parameters, you do not need the open and close brackets in the subroutine definition or in the call statement.

For functions with no parameters, you do need the open and close brackets in both the function definition and the statement which references the function.

Examples:

      program test

      real*8 a, john
      
      call fred

      a = john()

      end

      subroutine fred
        print *, 'Executing subroutine FRED'
      end

      real*8 function john()

      john = atan(0.7071d0)

      end 
Please login to reply.