create, use and destroy a 2d array

Here's an example of how you can create, use, and destroy a 2D array in Fortran:

program two_dimensional_array
  implicit none

  integer, parameter :: n = 3, m = 4
  integer :: i, j
  real :: array(n, m)

  ! Creating the array
  do i = 1, n
    do j = 1, m
      array(i, j) = i * j
    end do
  end do

  ! Using the array
  do i = 1, n
    do j = 1, m
      print*, array(i, j)
    end do
  end do

  ! Destroying the array (optional in Fortran)

end program two_dimensional_array

In this example, we first define the parameter n and m to represent the dimensions of the 2D array. We then declare the array variable as a 2D array with dimensions n and m.

To create the array, we use nested do-loops to iterate over each element of the array and assign a value to it. In this case, we are assigning the product of the row index i and the column index j to each element.

To use the array, we again use nested do-loops to iterate over each element of the array and print its value. You can replace the print* statement with any other operation or manipulation you want to perform on the array.

In Fortran, there is no explicit "destroy" operation for arrays. The array will be automatically deallocated and its memory will be freed when it goes out of scope, such as when the program ends.