create array

To create an array in Fortran, you can use the "DIMENSION" statement followed by the name of the array and its dimensions. Here's an example of how to create a 1D array with 10 elements:

INTEGER :: my_array(10)

This code declares an integer array named "my_array" with 10 elements. Each element in the array can store an integer value. You can access individual elements of the array using array indexing, where the index starts from 1. For example, to assign a value to the third element of "my_array", you can use the following code:

my_array(3) = 42

In this case, the value 42 is assigned to the third element of "my_array". You can also initialize the elements of an array when declaring it by providing a list of initial values enclosed in curly braces. For example:

INTEGER :: my_array(5) = [1, 2, 3, 4, 5]

This code declares an integer array named "my_array" with 5 elements and initializes them with the values 1, 2, 3, 4, and 5.