| 查看: 1160 | 回复: 4 | ||
[求助]
未分配内存的动态数组,如何作为参数传递到子函数,并在子函数中分配内存 已有2人参与
|
|
这是我的代码,编译不通过,提示错误是: ||Error: Dummy argument 'ns' of procedure 'rd' has an attribute that requires an explicit interface for this procedure| 代码请点这里查看 http://paste.ubuntu.com/6603805/ [ Last edited by heyzol on 2013-12-20 at 13:52 ] |
» 猜你喜欢
职称评审没过,求安慰
已经有56人回复
最近几年招的学生写论文不引自己组发的文章
已经有5人回复
26申博自荐
已经有3人回复
A期刊撤稿
已经有4人回复
» 本主题相关价值贴推荐,对您同样有帮助:

2楼2013-12-20 18:06:24
3楼2013-12-20 18:08:38

4楼2013-12-22 13:43:21
virtualzx
木虫 (著名写手)
- 应助: 263 (大学生)
- 金币: 7161.3
- 红花: 54
- 帖子: 1605
- 在线: 317.6小时
- 虫号: 2069080
- 注册: 2012-10-18
- 性别: GG
- 专业: 理论和计算化学
【答案】应助回帖
★ ★ ★ ★ ★
感谢参与,应助指数 +1
heyzol: 金币+5, ★★★★★最佳答案, 非常感谢 2013-12-23 12:53:37
感谢参与,应助指数 +1
heyzol: 金币+5, ★★★★★最佳答案, 非常感谢 2013-12-23 12:53:37
|
常用方法1,主程序里加入interface block interface subroutine rd(n,ns) integer :: n integer,allocatable :: ns( : ) end subroutine rd end interface 常用方法2,把子程序放在module里 module my_module contains // 把rd的定义放进来 subroutine rd(n,ns) ... end module my_module 然后在主程序里,只需要调用module,就会自动定义子程序。 program main use my_module integer :: n integer, allocatable :: ns( : ) call rd(n,ns) ... end program |
5楼2013-12-22 23:21:04













回复此楼