在Fortran 77中打印变量的地址

时间:2012-07-05 23:07:13

标签: pointers printing fortran77

如何在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);

谢谢!

1 个答案:

答案 0 :(得分:2)

虽然技术上不是Fortran 77,但大多数fortran编译器提供了一个LOC函数来获取变量的地址。

请参阅:http://gcc.gnu.org/onlinedocs/gfortran/LOC.html