1

Is it possible to have a pointer array to multiple targets?

Basically I want the following code to work

program main

  implicit none

  integer, target  :: a(2), b(3)
  integer, pointer :: ptr(:)

  a = [1, 2]
  b = [3, 4, 5]

  ptr => [a, b]     ! ERROR

  print *, ptr      ! should be 1,2,3,4,5

end program

Is it not possible as the targets might not be in in contiguous memory?

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.