This is my code for bubble sorting:

Code:
 
void CLEO_MedivisionView::OnNoiseremovalMedianfilter()
{
int n=262144;
for(int x=0; x<n; x++)
{
for(int y=0; y<n-1; y++)
{
if(image[y]>image[y+1])
{
int temp = image[y+1];
image[y+1] = image[y];
image[y] = temp;
}
}
}
 
}
When i compile and run this set of codes, my application crashes. Somewhat i have a feeling that the array size of 262144 is the issue. when i just keyed in 262 for the array size (n), i get my image[0] to image[261] sorted in an increasing order. but i cant check for my array size of 262144. is this somewhat of a syntax error or some array overflow issue? what should i do? please help me on this thanks.