Logo

Programming-Idioms

History of Idiom 207 > diff from v1 to v2

Edit summary for version 2 by tkoenig:
[Fortran] added declaration

Version 1

2019-09-30, 05:19:13

Version 2

2019-09-30, 05:19:42

Idiom #207 allocate a list that is automatically deallocated

Allocate a list / array a containing n elements (n assumed to be too large for a stack) that is automatically deallocated when the program exits the scope it is declared in.

Idiom #207 allocate a list that is automatically deallocated

Allocate a list / array a containing n elements (n assumed to be too large for a stack) that is automatically deallocated when the program exits the scope it is declared in.

Code
  allocate (a(n))
Code
  integer, dimension(:), allocatable :: a
  allocate (a(n))