This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
fortran [2010/03/22 10:58] zdech |
fortran [2010/04/09 09:30] zdech |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | **manual svn** [[http://svnbook.red-bean.com/en/1.1/ch03s05.html]] | ||
+ | |||
+ | |||
+ | |||
====== Pointers on functions and subroutines in Fortran ====== | ====== Pointers on functions and subroutines in Fortran ====== | ||
Line 40: | Line 44: | ||
module HelloWorld | module HelloWorld | ||
+ | | ||
procedure(Hello1), pointer :: ptr | procedure(Hello1), pointer :: ptr | ||
| | ||
Line 58: | Line 62: | ||
| | ||
end module | end module | ||
- | | ||
| | ||
program main | program main | ||
use HelloWorld | use HelloWorld | ||
+ | | ||
ptr => Hello1 | ptr => Hello1 | ||
call ptr(1,1.0) | call ptr(1,1.0) | ||
+ | | ||
ptr => Hello2 | ptr => Hello2 | ||
call ptr(2,2.0) | call ptr(2,2.0) | ||
end program | end program | ||
+ | |||
+ | ==== output ==== | ||
+ | zdenka@pc209:~/simulations/fireball/ptr_func$ ifort -c main.f90 -o main.o;ifort main.o -o test;./test | ||
+ | Ahoj 1 1.000000 | ||
+ | Nazdar 2 2.000000 | ||
====== Links - new features in fortran 95/2003: ====== | ====== Links - new features in fortran 95/2003: ====== |