Description of the steps

Can someone please give me description of the steps.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
r=new double*[jmax];
z=new double*[jmax];
T=new double*[jmax];
TOLD=new double*[jmax];
qr=new double*[jmax-1];
qz=new double*[jmax-1];
rr=new double*[jmax-1];
rz=new double*[jmax-1];
Qr=new double*[jmax-2];
Qz=new double*[jmax-2];
for(j=0;j<jmax;j++)
{
r[j]=new double[imax];
z[j]=new double[imax];
T[j]=new double[imax];
TOLD[j]=new double[imax];
}
for(j=0;j<jmax-1;j++)
{
qr[j]=new double[imax-1];
qz[j]=new double[imax-1];
rr[j]=new double[imax-1];
rz[j]=new double[imax-1];
}
for(j=0;j<jmax-2;j++)
{
Qr[j]=new double[imax-2];
Qz[j]=new double[imax-2];
}
You're missing these steps.
https://en.wikipedia.org/wiki/Indentation_style
http://sscce.org/

It allocates a bunch of memory to very badly named variables.
What else do you want to know?
closed account (E0p9LyTq)
It allocates a bunch of memory to very badly named variables.

I'd add that it vastly increases the likelihood of memory leaks with that many uses of new.

That code is a time bomb waiting to explode.

And salem c, thanks for the link to "Short, Self Contained, Correct (Compilable), Example." I've added it to my list of "if you want to learn to program properly read this!" links.
Topic archived. No new replies allowed.