2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1 +1,5 @@
|
|||
Show how to explicitly allocate and deallocate blocks of memory in your language. Show access to different types of memory (i.e., [[heap]], [[system stack|stack]], shared, foreign) if applicable.
|
||||
;Task:
|
||||
Show how to explicitly allocate and deallocate blocks of memory in your language.
|
||||
|
||||
Show access to different types of memory (i.e., [[heap]], [[system stack|stack]], shared, foreign) if applicable.
|
||||
<br><br>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
program allocation_test
|
||||
implicit none
|
||||
real, dimension(:), allocatable :: vector
|
||||
real, dimension(:, :), allocatable :: matrix
|
||||
real, pointer :: ptr
|
||||
integer, parameter :: n = 100 ! Size to allocate
|
||||
|
||||
implicit none
|
||||
|
||||
real,dimension(:),allocatable :: vector
|
||||
real,dimension(:,:),allocatable :: matrix
|
||||
|
||||
integer,parameter :: n = 100 !size to allocate
|
||||
|
||||
allocate(vector(n)) !allocate a vector
|
||||
allocate(matrix(n,n)) !allocate a matrix
|
||||
deallocate(vector) !deallocate a vector
|
||||
deallocate(matrix) !deallocate a matrix
|
||||
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
|
||||
end program allocation_test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue