Consider
INTEGER,DIMENSION(3) :: NumberVector
and
INTEGER :: NumberVector(3)
Is there any difference whatsoever between these two declarations or are they exactly the same? (I mean in ANY possible context and variation: for example, in the case that those two were identical, what if I am declaring an array with an implicit size as one of the input parameter of a subroutine? Would it still be irrelevant which one I used?)
Fortran stores higher dimensional arrays as a contiguous sequence of elements. It is important to know that 2-dimensional arrays are stored by column. So in the above example, array element (1,2) will follow element (3,1). Then follows the rest of the second column, thereafter the third column, and so on.
C arrays always start at zero, but by default Fortran arrays start at 1. There are two usual ways of approaching indexing. You can use the Fortran default, as in the preceding example. Then the Fortran element B(2) is equivalent to the C element b[1] .
Yes, it is identical. Even for assumed, deferred and whatever possible shape.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With