title: Allocate multi dimensional array from a data file
body: <p>I have a file containing information about a multi-dimensional array. I have created a subroutine that reads the file and copies
  the array data to an array variable. My problem is that I have to first allocate the dimensions of the array outside the subroutine first. Is there a way to allocate the array inside my subroutine as the array dimensions are also stored in the data file.</p>
  
  <p>Currently I have the following code, where I first allocate the multi-dimensional array and then populate it by calling <code>selcs</code>.</p>
  
  <pre><code>Allocate (c3d(nu,nv,nw))
  Call selcs (c3d, nm, cpht, rsl, st)
  c3d = c3d * 2.0
  Deallocate (c3d)
  </code></pre>
  
  <p>I would prefer to have the subroutine <code>selcs</code> itself allocate
  the memory for <code>c3d</code> using dimensional information present in the file and then use the array outside <code>selcs</code> as before.</p>
  
  <pre><code>Call selcs (c3d, nm, cpht, rsl, st)
  c3d = c3d * 2.0
  Deallocate (c3d)
  </code></pre>