MarzAttax
Joined: 15 Jun 2006 Posts: 46
|
Posted: Thu Jul 20, 2006 5:19 am Post subject: Pointers (3) |
|
|
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 |
|