I trying to get dynamic memory allocation to work but i cant seem to get it right.
program test
implicit none
integer i,j, error,size
real, dimension(2), allocatable :: inputMatrix
print *, "Input the number of equations (and variables): "
read *, size
allocate (inputMatrix(size,size), stat = error)
print *, "enter coefficients from your equations"
do i = 1, size
do j = 1, size
read *, inputMatrix(j,i)
end do
end do
deallocate (inputMatrix, stat = error)
end program
when i compile i get
Error 1 error #6646: ALLOCATABLE or POINTER attribute dictates a deferred-shape-array [INPUTMATRIX] C:\Users\Nathan\Documents\fortran\test.f90 8
any ideas why? if there are logic errors that would not effect compilation, the don't bother mentioning them i just want it to compile. I can debug it later when i write the rest of the program.