- #1
- 3,971
- 329
Hi, I'm just wondering real quick, are equations allowed in array declarations? For example:
int :: y=2
int, dimension(2*y):: x
?
int :: y=2
int, dimension(2*y):: x
?
Fortran array declaration is the process of defining an array, which is a collection of data items of the same type, in Fortran programming language. It involves specifying the type of data, the size and shape of the array, and the name of the array.
To declare a one-dimensional array in Fortran, you need to use the DIMENSION statement and specify the size of the array. For example, to declare an array named "my_array" with 10 elements of type integer, you would use the statement DIMENSION my_array(10).
Yes, you can declare arrays of different data types in Fortran. This is known as a heterogenous array. For example, you can declare an array that contains both integer and real numbers.
The maximum number of dimensions that can be declared for an array in Fortran is seven. This means that an array can have up to seven indices to access its elements.
No, the size of an array cannot be changed after it is declared in Fortran. However, you can create a new array with a different size and copy the elements from the original array to the new one.