From: Richard Maine on
Raj <raj6586(a)> wrote:

> Thank you very much for your explanation. I understood it. But can I
> store the values of pointer in a allocatable array and use it? Say, B
> is defined as REAL, POINTER, DIMENSION (:,:) :: B and C is defined as
> REAL, ALLOCATABLE, DIMENSION (:,:) :: C. Can I have two do loops in
> which I assign values of C from B? (array B already has values).

Of course. They are still arrays. That is the fundamental thing here.
The answer to *ANY* question about what you can do with elements of
allocatable or pointer arrays is that it doesn't matter. That's because
the allocatableness or pointerness is not a property of the elements. It
is only a property of the array as a whole - not of the elements.

Even more fundamental, though, is that values don't have a property of
being from something. They are just values. It doesn't matter where they
came from.

If you have an assignment statement, say

c(6,7) = 42.

There is no issue about whether that 42. is an allocatable or a pointer.
It is neither. It is just a value. More properly, it is just an
expression that computes a value. In this particular case, the
expression happens to be a trivial one, but it still counts as an
expression, just like

c(6,7) = 40. + 2.

Likewise, in

c(6,7) = b(6,7)

it is irrelevant whether b is a pointer, and allocatable, or not. All
that matters is that it gives a value. That value is not a pointer or an
allocatable; it is just a value. (It is important that b(6,7) must have
a value; it must not be undefined.)

Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain