문제

I have a parameter being declared in a fortran header file like this:

parameter (param=((0-565)))

param always seems to be valued at 565. Basis tutorials on parameters don't include information about what the ((0-565)) actually means in this context and my google-fu isn't up to this challenge.

도움이 되었습니까?

해결책

The code

program main
implicit none
integer :: param
parameter (param=((0-565)))
! integer, parameter :: param = -565 ! suggest replacing two lines above with this
print*,"param =",param
end program main

sets param to -565, as confirmed by both g95 and gfortran. The comment line uses a suggested modern syntax, assuming param is of the integer data type.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top