Silverfrost Forums

Welcome to our forums

Pointers (3)

20 Jul 2006 4:19 #872

As you can see, I am having troubles with pointers - lol

Please review the following code:

=============================================

Module Managerie

Type stFerret Integer*4, Pointer :: iTeeth(:) End Type

Type stZoo Type(stFerret) pstFerret End Type

Type(stZoo) pstZoo

End Module Managerie

=============================================

Module Point

USE Module Managerie

Type(stFerret), Pointer :: pstFerret

pstFerret ⇒ pstZoo%pstFerret Call DoSomething(pstFerret)

End Module Point

=============================================

Module Direct

USE Module Managerie

Type(stFerret) pstFerret

Call DoSomething(pstFerret)

End Module Direct

=============================================

Module DoIt

Subroutine DoSomething(pstFerretP)

(A) Type(stFerret), Pointer :: pstFerretP (B) Type(stFerret) pstFerretP

End Subroutine

End Module DoIt

=============================================

I guess you get the gist. Now in Module DoIt, should I use (A) or (B)? Does it matter. Is there a better way to set up things. Should I use 'TARGET' somewhere?

Agian, thanx in advance for any help.

Bri

Please login to reply.