Fortran函数调用是Call by Reference的

以前学Fortran时,对这个问题根本没反应,现在不得不查一下。

网上资料里,说Fortran是Call by Reference的。不过还不放心,索性写段小程序测一下:

PROGRAM SWAP_TEST
    IMPLICIT NONE
    INTEGER M, N
    M = 1
    N = 2
    CALL SWAP(M, N)
    WRITE(*, *) M, N
END PROGRAM SWAP_TEST

实测结果是Call by Reference的。

Advertisements
此条目发表在未分类分类目录。将固定链接加入收藏夹。

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s