I have two arrays of type Region
, both of size 1000, and at every iteration of a loop I want to swap the two of them (by swapping their memory addresses). I was hoping this would work:
Region *swap = (Region*)myRegions;
myRegionsLast = myRegions;
myRegions = (Region[1000])swap;
Line one seems fine. The second and third lines are invalid assignments, as you apparently can't re-assign that type. The third line is also invalid because you can't cast to the type (Region [1000])
. Obviously I don't want to allocate whole new Region[1000] if I can help it. Can someone help me accomplish what I want?