3

如何在 Fortran 77 中打印变量的地址?例子:

      subroutine foo

      integer d3
c Now I want to print "Address of d3: " followed by its address.

当然,C 中的等价物是

int d3;
printf("Address of d3: %p\n", &d3);

谢谢!

4

1 回答 1

2

尽管在技术上不是 Fortran 77,但大多数 fortran 编译器都提供了 LOC 函数来获取变量的地址。

见: http: //gcc.gnu.org/onlinedocs/gfortran/LOC.html

于 2012-07-05T23:29:48.160 回答