RosettaCodeData/Task/Memory-allocation/Fortran/memory-allocation.f

16 lines
547 B
FortranFixed
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
program allocation_test
2016-12-05 22:15:40 +01:00
implicit none
real, dimension(:), allocatable :: vector
real, dimension(:, :), allocatable :: matrix
real, pointer :: ptr
integer, parameter :: n = 100 ! Size to allocate
allocate(vector(n)) ! Allocate a vector
allocate(matrix(n, n)) ! Allocate a matrix
allocate(ptr) ! Allocate a pointer
deallocate(vector) ! Deallocate a vector
deallocate(matrix) ! Deallocate a matrix
deallocate(ptr) ! Deallocate a pointer
2013-04-10 21:29:02 -07:00
end program allocation_test