title: Create array containing other declared variables in Fortran
body: <p>I would like to create an array containing variables that have already been declared, so that I can loop through this array to access the elements by its index and carry out some operation. In Python, this would be easy. Say I want to create a <code>target_array</code>:</p>
  <pre><code>a = [3,4]
  b = [5,6]
  
  target_array = [a,b]
  
  for ta in target_array:
  
      # some operation here
  
  </code></pre>
  <p>However, I am not sure how can I do this in Fortran. I tried the following:</p>
  <pre><code>real, dimension(2,2,2) :: a
  real, dimension(2,2,2) :: b
  
  real, parameter :: target_array = [a,b]
  integer :: i
  real, dimension(2,2,2) :: target_var
  
  do i = 1,SIZE(target_array)
     
     target_var = target_array(i)
  
     ...
  
  end do
  
  </code></pre>
  <p>However, I received the following error for the line where i declare <code>target_array</code>:</p>
  <pre><code>This symbol must be a defined parameter, an enumerator, or an argument of an inquiry function that evaluates to a compile-time constant.   [a]
  </code></pre>
  <p>Can someone help? Thank you!</p>