- #1
Eclair_de_XII
- 1,083
- 91
- TL;DR Summary
- In particular, I am having trouble creating a subroutine that takes an array and a pointer as arguments, and has the pointer reference the largest element of the array.
1_point-to-biggest.f90:
program main
implicit none
real,dimension(3),target::x=[0,4,5]
real,pointer::y
call point_to_biggest(x,y)
!print *,y ! For testing purposes; to be unmuted only when y points to something
contains
subroutine point_to_biggest(array,ptr)
implicit none
real,dimension(:),intent(in),target::array
real,pointer,intent(in)::ptr
!ptr=>array(maxloc(array)) ! Results in gfortran thinking that array(maxloc(array)) is some sort of rank-1 object
end subroutine point_to_biggest
end program main
Last edited: