I am converting a part of FORTRAN 77 code to C++
DIMENSION ARRAY(513),JRRAY(2,513)
EQUIVALENCE (ARRAY(1),JRRAY(1,1))
This is implicit code where every variable name starting with I,J,K,L,M,N,O,P are implicitly taken as integer type. Thus, here we have an double precision array named ARRAY and a integer array named JRRAY.
The equivalence statements points the start of both arrays to the same memory location. Somehow, however, the bytes are interpreted differently as double when ARRAY(I) is called or integers when JRRAY(I,J) is called (at least that is what I think what happens).
Is there a similar way in C++ where the same memory location can be interpreted as a different type?
Or something that does the same as EQUIVALENCE in FORTRAN, but then in C++.