I have two sets of global variables, which are each stored in a named common block like this:
integer :: x1, y1, z1, x2, y2, z2
common/vars/ x1, y1, z1
common/vars/ x2, y2, z2
There are two different things I want to be able to do with these variables:
- Store the values of each set of variables in an array, such that the end result would be the arrays defined by
integer :: a(3) = (/ x1, y1, z1 /), b(3) = (/ x2, y2, z2 /) - Store the values in the second set in their counterpart variables of the first set. That is:
x1 = x2,y1 = y2, andz1 = z2.
However, in the actual code there are a lot more than 3 variables in each set. Therefore I want to be able to do this using loops. In C/C++ I would be able to do this easily by incrementing pointers. However, pointers do not work like that in Fortran. Is there any way to accomplish this?
Don't know what your Fortran compiler supports, but here's a few ideas (hacks) using DEC Fortran-77.