| 查看: 1252 | 回复: 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 ] |
» 猜你喜欢
0855求调剂材料
已经有12人回复
297分083200求助
已经有7人回复
070300化学学硕311分求调剂
已经有10人回复
专硕0854初试考材科基,求调剂
已经有8人回复
0857大类环境工程B区求调剂
已经有3人回复
0817化学工程与技术求调剂,一志愿中海洋319
已经有14人回复
0703化学调剂325分
已经有11人回复
286求调剂
已经有8人回复
求调剂
已经有5人回复
生物学308分求调剂(一志愿华东师大)
已经有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














回复此楼