I have a problem with my code and don't really know, how to handle it. Exercise is, to have a 2D allocatable Array as a type. Then declare the values with even numbers throughout.
I get an syntax error and an unclassifiable statement, when I want to compile my code.
Can anybody guide me through, how to create an array and initialize values using a type (constructor, as I know it from java?)
Here is my source code;
program main
type myfield
integer, allocatable :: elem(:,:)
logical :: initialised = .false.
integer :: i, j, k
end type myfield
type(myfield) :: phi
phi = myfield(1:10, 1:3)
k = 2
do j=1, 3
do i=1, 10
phi(i, j) = k
k = 2 * k
end do
end do
end program main
ERROR MESSAGE: '''
$ gfortran -c Ex.2.3.f90
Ex.2.3.f90:13:16:
phi = myfield(1:10, 1:3)
1
Error: Syntax error in argument list at (1)
Ex.2.3.f90:17:3:
phi(i, j) = k
1
Error: Unclassifiable statement at (1)
'''