okay it settled the stack overflow problem. so coming back to the MAIN issue.
looking at this codeline:

for (i=2; i<262144-2; i++) {
meanarray[i - 2]= (image[i - 2] +image[i - 1] +image[i] +image[i + 1] +image[i + 2]) / 5;
} //  ----> toggled breakpoint
what i want to do is to find the average values of image[0] to image[4] WHEN i=2. so what i should get in meanarray[] is the average of the 5 image[] values until the condition ends at i<262144-2.. at the moment when i debug at the breakpoint shown and return the values for meanarray[], i dont get any values.. what i get was showing meanarray is not even an array! it just shows me ZERO. i really need help on this. thanks