Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Allocatable Arrays in Fortran

Yadav__Geetanjali
641 Views

Hello,

Can someone please help me understand what are allocatable arrays while writing a code in Fortran? When do we allocate/deallocate arrays? What is the role of the module? 

Thanks

0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
641 Views

It is advisable to consult the documentation under the index of "allocatable arrays".

Essentially, an allocatable array is a placeholder of a descriptor that will define the rank (number of dimensions), size(s), and extents of an array who's capacity is unknown until runtime.

Older language standards require explicit allocation and deallocation, newer language features permit automatic allocate, reallocate, and deallocate of arrays.

Jim Dempsey
 

0 Kudos
David_DiLaura1
641 Views

Ms. Yadav

Judging from your question, I would suggest that some background reading would be the best way to become familiar with the purpose/operation/use of allocatable arrays. BUT, most books on Fortran are little more than a reiteration of the latest Fortran standard which simply states facts rather than provide background and (actually) assume the reader already understands Fortran concepts. They are very difficult to learn from. There is one book that I can recommend: Modern Fortran Explained by Metcalf, Reid, and Cohen.

https://www.amazon.com/gp/product/0199601429/ref=s9_acsd_simh_hd_bw_b129_c_x_2_w?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=merchandised-search-3&pf_rd_r=00QR9QSMAGVEG8K0QASG&pf_rd_t=101&pf_rd_p=90ec9561-6fbb-5489-b2b5-bae412a1c983&pf_rd_i=3977

I think you will find the book as a whole to be very helpful and the section on alloacatable arrays particularly so.

0 Kudos
Yadav__Geetanjali
641 Views

Thank you Jim and David

0 Kudos
Reply