Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi!i m having a problem with an array i m using inside a double loop to store some results,but im a bit stuck on how i ll use this array in another function.
i get that psd (this is the array) isnt declared.I know that psd is declared locally inside the loop at the moment,but as i said i m a bit stuck on how to proceed.It has to be something easy that i cant see i guess...
thank you for any suggestionsint x,y;
for (x=0;x<128;x++)
{
for (y=0;y<96;y++)
{ int pixelofpsb,pixelofpsc;
pixelofpsb= get_pixel2(x,y);
pixelofpsc= get_pixel3(x,y);int psd[128][96];
psd[x][y] = (pixelofpsb)^(pixelofpsc);
}
}
scanleft2(Coords[0].x,Coords[0].y,psd);
//here is where i need to use psd.scanleft scans the pixels of the image until it finds a black pixel-------------
int CMainFrame::scanleft2(int &x,int &y,int *Pic)
{
for (x=0;x<128;x++)
{
for (y=0;y<96;y++)
{
if (ChunkyGetPixel2(x,y,5,Pic) == BLACK)
return 1;
}
}
return 0;
}

Hi Jim!
The problem is that the array is declared within the scope of the inner for-loop. Outside the for loop it will not be accessable.
Decare it at the top of the function you intend to use it and then you can access it throughout that function and also be able to pass it to your other function.
/ Marcus
Ps. Fix up those variable name.. =)

![]() |
javascript value for PHP ...
|
Visual Basic for Applicat...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |