Fortran Coder

查看: 7266|回复: 2
打印 上一主题 下一主题

[子程序] 关于intent属性的问题!

[复制链接]

9

帖子

3

主题

0

精华

入门

F 币
68 元
贡献
37 点
跳转到指定楼层
楼主
发表于 2014-10-28 15:53:36 | 显示全部楼层 |只看大图 回帖奖励 |倒序浏览 |阅读模式
编写了一个小程序,程序见附录!为了便于说明截了两张图,图一是程序截图,图二是错误提示截图
如果把integer,intent(out):: z去掉的话,可以编译成功!
所以迷茫intent(out)该怎么用!!!
[Fortran] 纯文本查看 复制代码
module param
integer :: x,y,z,a,b,c,d
contains

subroutine haha(x,y)
implicit none
integer ,intent(in):: x
integer ,intent(in):: y
integer ,intent(out):: z !// 此处
z=x+y
print*,'z',z
return
end subroutine haha

end module param

program test
use param
implicit none
x=1
y=2
call haha(x,y)

end program test

DeepinScreenshot20141028154920.png (84.41 KB, 下载次数: 198)

DeepinScreenshot20141028154920.png
分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-6-2 15:58

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表