Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hey, guys, trying to learn "Pointer

Status
Not open for further replies.

salgerman

Programmer
Jan 14, 2010
520
US
Hey, guys, trying to learn "Pointers as aliases", here.

I am wanting to do some cshift-ing on one dimension of 3 dimensional array that has been over-allocated due to capacity needs in a parallel dimension.

Here is what I have in mind:
Code:
program sub     
    integer , allocatable   , dimension(:,:,:) :: strandPos
    integer , dimension(:,:), pointer          :: stacks
                
    allocate( strandPos(2, 10, 30) )
    strandPos = 0
    stacks => strandPos(1,1:8,1:20)        
    write(*,*) stacks             
end program sub

But, when I try to compile, I get the following error:
Code:
In file sub.f90:8
        stacks => strandPos(1,1:8,1:20)        
                  1
Error: Pointer assignment target is neither TARGET nor POINTER at (1)

What am I not understanding?

A lesson, please.

Germán


 
Oh, I think I found it...need to make it TARGET.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top