For those of us who need to port from Fortran:
In C++ there is no equivalent structure to Fortran's
EQUIVALENCE. (No pun intended!)
After doing some searching, I could not find an appropriate code, so I am suggesting the following "work-around" using the
The basic idea is that the same portion of the memory is accessed by different data. (Variables or data types).
for (int i=0;i<3;i++) cout<<mix.x[i]<<endl;
I wish to give credit to this article.