**** Post for FREE via your newsreader at post.usenet.com ****
I have a pointer to point to data array.
I have a for loop. And I need to define different array size in the for
loop.
for example:
iter=4;
float **xp;
for(int i=0; i<4; i++){
xs1=(int)(floor(xdim/(iter-i)));
ys1=(int)(floor(ydim/(iter-i)));
xp=new float *[xs1];
for(j=0; j<xs1; j++){
xp[j]=new float[ys1];
}
//implementations
}
My question is where should I delete the pointer, inside of the for loop or
outside of the for loop.
If outside of the for loop, what happend to those allocated memory at each
for loop.
Thanks!
Luke
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=