In a class I am allocating some variables:
double *x1, *x2, *x3;
x1 = new double [3];
x2 = new double [3];
x3 = new double [3];
During the run I am checking the memory. I found that the address of x1[2] & x2[0] are the same. Also, the address of x2[2], x3[0] are same.
x1 address = 0x7fc4334037e0, 0x7fc4334037e8, 0x7fc4334037f0
x2 address = 0x7fc4334037f0, 0x7fc4334037f8, 0x7fc433403800
x3 address = 0x7fc433403800, 0x7fc433403808, 0x7fc433403810
How can I solve this problem?
Aucun commentaire:
Enregistrer un commentaire