I had such code to copy three 2D arraya around by using pointers like below, but it seems all three pointers are pointing to the same memory address. How can I get it correctly?
float **U_past, **U_future, **V_past, **V_future, **U_pp, **V_pp;
In construct :
U_past = new float*[a]; //a=100
U_future = new float*[a];
U_pp = new float*[a];
for(int i=0; i<nsigma; i++) {
U_past = new float[e]; //e=400
U_future = new float[e];
U_pp = new float[e];
}
and in main fuction I want to do
U_pp = U_past; //save U_past data in U_pp
U_past = U_future; //save U_future data in U_past
U_future = new_data; //get new data for U_future
in destruct
delete [] U_past;
delete [] U_future;
delete [] V_pp;
The expect data would be like
first aound : U_pp[0][0]=0.1, U_past[0][0] =0.2, U_future[0][0]=0.3;
second round : U_pp[0][0]=0.2, U_past [0][0]=0.3, U_future[0][0]=1.4;
thrid : U_pp[0][0]=0.3, U_past [0][0]=1.4, U_future[0][0]=2.3;
How should I make it? Thanks.