I have a problem assigning a pointer to a structure, to a pointer to a structure. I use gfortran 4.6.3, and the name of the file is test_pointer_struct.f08 so I am using the Fortran 2008 standard (as supported by gfortran 4.6.3).
Hera comes the code:
PROGRAM test_pointer_struct type tSmall integer :: a double precision :: b end type tSmall type tBig integer :: h type(tSmall), pointer :: member_small end type tBig type(tBig) :: var_big type(tSmall), pointer :: var_small(:) ! We get an array of pointers to the small structure allocate(var_small(3)) ! Also allocate the member_small strucutre (not an array) allocate(var_big%member_small) var_big%member_small%a = 1 var_big%member_small%b = 2.0 ! Now we want an element of the var_samall array of pointers, to point to the member_small in member_big var_small(1) => var_big%member_small ! <- I get a compilation error here ! And dissasociate the member_small (we still maintain access to memory space through var_small(1) var_big%member_small => NULL() END PROGRAM test_pointer_struct
When I complie this, I get the following error: Error: Se esperaba una especificación de límites para 'var_small' en (1) Which could be translated as Error: Limit specification expected for 'var_small' at (1)
What does this error mean?. What am I doing wrong?
Thank you very much in advance.