Segfault when calling a function with a constant argument

前端 未结 5 453
一个人的身影
一个人的身影 2020-12-21 13:58

I have written this very simple code in Fortran:

program su
  implicit none
  real ran3
  write(*,*) ran3(0)
end program su

real*8 function ran3(iseed)
  im         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-21 14:41

    First you have to define idum as an integer.

      program su
      implicit none
      integer idum
      real ran3
      idum = 334
      write(*,*) ran3(idum)
      end program su
    

    then your code will work

提交回复
热议问题