Hi thanks for replying. I managed to have the mean values now. AQctually i solved the stack overflow issue by doing 2 things: first i changed my variable to meanarray1[] instead and i declare this into the global definition way up in this whole programme.

I now want to do median filter. I am unsure how to sort the arrays out from increasing order. Can u give me some hints on how to go about?