Home > Back-end >  Strives for the bosses to help have a look
Strives for the bosses to help have a look

Time:11-18

At first in the loop wrote a dynamic array, can run normally, when I write the definition of a dynamic array at the end of the cycle, release the memory write at the beginning of the cycle, from the second cycle begins to release the memory, is a dynamic array at the end of the current loop, to the next cycle begins to release the memory, appear the error, caused abnormal: read access rights conflict, L is 0 x1110112, how should solve? I am a novice, program about as follows, please help, find out where is the problem then tell me how to change, thank you!

# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
using namespace std;

Struct D
{
int n;
};

D * * * * * LMP_Store;

Int nn=0;
Int L1=0, L2=0, L3=0, B=0;

Void main ()
{
Do
{
Int q, I, j, k;
Nn +=1;
If (nn & gt; 1)
{
For (q=0; Q & lt; B; Q++)
{
For (I=0; i {
For (j=0; J & lt; L2; J++)
{
For (k=0; K & lt; L3. K++)
{
The delete [] LMP_Store [q] [I] [j] [k];
LMP_Store [q] [I] [j] [k]=NULL;
}
The delete [] LMP_Store [q] [I] [j];
LMP_Store [q] [I] [j]=NULL;
}
The delete [] LMP_Store [q] [I];
LMP_Store [q] [I]=NULL;
}
The delete [] LMP_Store [q];
[q] LMP_Store=NULL;
}
The delete [] LMP_Store;
LMP_Store=NULL;
}
B=nn;
L1=nn;
L2=nn;
L3=nn;
D * * * * * LMP_Store=new D * * * * [B];
For (q=0; Q & lt; B; Q++)
{
LMP_Store [q]=new struct D * * * [L1];
For (I=0; i {

LMP_Store [q] [I]=new struct D * * [L2];
For (j=0; J & lt; L2; J++)
{

LMP_Store [q] [I] [j]=new struct D * (L3);
For (k=0; K & lt; L3. K++)
{

LMP_Store [q] [I] [j] [k]=new struct D;
}

}
}
}
} while (nn & lt; 500);
}

CodePudding user response:

The L3 new one, delete []

CodePudding user response:

Bosses, I didn't understand your meaning, can say again
  • Related