Array problem

Hello
I am using Arduino nano for my project of weather station. I tried to made a simple weather forecast algorithm. Unfortunately i have a problem, array of pressure samples is overwritten.
Here is a code:

int sample(int pressure)
{
        static int minuteCount;
        static int hoursCount;
        static int cycleCount;
        static float pressureAvgAllTime;
        static float minPressureAvg;
        static float maxPressureAvg;
        static int pressureSamples[4];
        static int dP_dt;
        static bool forecast_debug = true;
        static float lastHoursPressureAvg[12];
        static float pressureAvg[24][3];
        if (forecast_debug == true)
        {
            Serial.print(F("Forecast update, minute:"));
            Serial.print(minuteCount);
            Serial.print(F(", hoursCount:"));
            Serial.print(hoursCount);
            Serial.print(F(", cycleCount:"));
            Serial.print(cycleCount);
            Serial.print(F(", dP_dt:"));
            Serial.print(dP_dt);
            Serial.print(F(", pressureAvgAllTime:"));
            Serial.print(pressureAvgAllTime);
            Serial.print(F(", minPressureAvg:"));
            Serial.print(minPressureAvg);
            Serial.print(F(", maxPressureAvg:"));
            Serial.print(maxPressureAvg);
            Serial.print(F(", sample:"));
            Serial.print(pressure);
            Serial.print(F(", lastHoursPressureAvg"));
            Serial.print(lastHoursPressureAvg[((minuteCount + 1)/5)  - 1]);
            Serial.print(F(" uptime:"));

            Serial.println(millis());

            int h = 0;
            int i = 0;

            while (h < 25)
            {
              Serial.print(" pressureAvg");
              Serial.print(h);
              Serial.print("_");
              Serial.print(i);
              Serial.print(":");
              Serial.print(pressureAvg[h][i]);
              i++;
              if (i == 4)
              {
                i = 0;
                h++;
                Serial.println("");
              }
            }


        }

        pressureSamples[cycleCount] = pressure;

        if (cycleCount == 4)
        {
          cycleCount = -1;
          lastHoursPressureAvg[((minuteCount + 1)/5)  - 1] = (pressureSamples[0] + pressureSamples[1] + pressureSamples[2] + pressureSamples[3] + pressureSamples[4]) / 5;
          Serial.print(((minuteCount + 1)/5)  - 1);
          Serial.print(F("pressureAvg last 5 min: "));
          Serial.println(lastHoursPressureAvg[((minuteCount + 1)/5)  - 1]);

          if (hoursCount == 0 && minuteCount == 4)
          {
            pressureAvgAllTime = lastHoursPressureAvg[0];
            maxPressureAvg = lastHoursPressureAvg[0];
            minPressureAvg = lastHoursPressureAvg[0];
            pressureAvg[0][0] = lastHoursPressureAvg[0];
          }
          else
          {
            pressureAvgAllTime = (pressureAvgAllTime + lastHoursPressureAvg[((minuteCount + 1)/5)  - 1]) / 2;
            if (lastHoursPressureAvg[((minuteCount + 1)/5)  - 1] < minPressureAvg) minPressureAvg = lastHoursPressureAvg[((minuteCount + 1)/5)  - 1];
            if (lastHoursPressureAvg[((minuteCount + 1)/5)  - 1] > maxPressureAvg) maxPressureAvg = lastHoursPressureAvg[((minuteCount + 1)/5)  - 1];
          }

          if ((minuteCount + 1) % 15 == 0)
          {
            pressureAvg[hoursCount][((minuteCount + 1) / 15) -1 ] = (lastHoursPressureAvg[((minuteCount + 1)/5)  - 1] + lastHoursPressureAvg[((minuteCount + 1)/5)  - 2] + lastHoursPressureAvg[((minuteCount + 1)/5)  - 3]) / 3;
          }


        }

        if (minuteCount + 1 == 60)
        {
		minuteCount = -1;
                hoursCount++;
        }

        minuteCount++;
        cycleCount++;
        if (hoursCount == 0 && minuteCount < 30) return 5;
        return 5;
}

Here is output from serial after same time:

Forecast update, minute:7, hoursCount:0, cycleCount:2, dP_dt:0, pressureAvgAllTime:3.00, minPressureAvg:3.00, maxPressureAvg:3.00, sample:8, lastHoursPressureAvg3.00 uptime:14442
 pressureAvg0_0:3.00 pressureAvg0_1:0.00 pressureAvg0_2:0.00 pressureAvg0_3:0.00
 pressureAvg1_0:0.00 pressureAvg1_1:0.00 pressureAvg1_2:0.00 pressureAvg1_3:0.00
 pressureAvg2_0:0.00 pressureAvg2_1:0.00 pressureAvg2_2:0.00 pressureAvg2_3:0.00
 pressureAvg3_0:0.00 pressureAvg3_1:0.00 pressureAvg3_2:0.00 pressureAvg3_3:0.00
 pressureAvg4_0:0.00 pressureAvg4_1:0.00 pressureAvg4_2:0.00 pressureAvg4_3:0.00
 pressureAvg5_0:0.00 pressureAvg5_1:0.00 pressureAvg5_2:0.00 pressureAvg5_3:0.00
 pressureAvg6_0:0.00 pressureAvg6_1:0.00 pressureAvg6_2:0.00 pressureAvg6_3:0.00
 pressureAvg7_0:0.00 pressureAvg7_1:0.00 pressureAvg7_2:0.00 pressureAvg7_3:0.00
 pressureAvg8_0:0.00 pressureAvg8_1:0.00 pressureAvg8_2:0.00 pressureAvg8_3:0.00
 pressureAvg9_0:0.00 pressureAvg9_1:0.00 pressureAvg9_2:0.00 pressureAvg9_3:0.00
 pressureAvg10_0:0.00 pressureAvg10_1:0.00 pressureAvg10_2:0.00 pressureAvg10_3:0.00
 pressureAvg11_0:0.00 pressureAvg11_1:0.00 pressureAvg11_2:0.00 pressureAvg11_3:0.00
 pressureAvg12_0:0.00 pressureAvg12_1:0.00 pressureAvg12_2:0.00 pressureAvg12_3:0.00
 pressureAvg13_0:0.00 pressureAvg13_1:0.00 pressureAvg13_2:0.00 pressureAvg13_3:0.00
 pressureAvg14_0:0.00 pressureAvg14_1:0.00 pressureAvg14_2:0.00 pressureAvg14_3:0.00
 pressureAvg15_0:0.00 pressureAvg15_1:0.00 pressureAvg15_2:0.00 pressureAvg15_3:0.00
 pressureAvg16_0:0.00 pressureAvg16_1:0.00 pressureAvg16_2:0.00 pressureAvg16_3:0.00
 pressureAvg17_0:0.00 pressureAvg17_1:0.00 pressureAvg17_2:0.00 pressureAvg17_3:0.00
 pressureAvg18_0:0.00 pressureAvg18_1:0.00 pressureAvg18_2:0.00 pressureAvg18_3:0.00
 pressureAvg19_0:0.00 pressureAvg19_1:0.00 pressureAvg19_2:0.00 pressureAvg19_3:0.00
 pressureAvg20_0:0.00 pressureAvg20_1:0.00 pressureAvg20_2:0.00 pressureAvg20_3:0.00
 pressureAvg21_0:0.00 pressureAvg21_1:0.00 pressureAvg21_2:0.00 pressureAvg21_3:0.00
 pressureAvg22_0:0.00 pressureAvg22_1:0.00 pressureAvg22_2:0.00 pressureAvg22_3:0.00
 pressureAvg23_0:0.00 pressureAvg23_1:0.00 pressureAvg23_2:0.00 pressureAvg23_3:3.00
 pressureAvg24_0:3.00 pressureAvg24_1:0.00 pressureAvg24_2:0.00 pressureAvg24_3:0.00

I have no idea why always end part of array is overwritten.

You only posted part of your program so there may be other problems but in this snippet from your snippet

 pressureSamples[cycleCount] = pressure;

  if (cycleCount == 4)

you sometimes write to pressureSamples[4] which is a shame because the highest index of pressureSamples[] is 3 so you are stomping on memory that is not part of the array.

This is a full program http://pastebin.com/cGb4Zu9g

you sometimes write to pressureSamples[4] which is a shame because the highest index of pressureSamples[] is 3 so you are stomping on memory that is not part of the array.

I tried to enlarge size of the array even to 10 but it's not help.

static float pressureAvg[24][3];
...
....
while (h < 25)
            {
              Serial.print(" pressureAvg");
              Serial.print(h);
              Serial.print("_");
              Serial.print(i);
              Serial.print(":");
              Serial.print(pressureAvg[h][i]);

Yes, you right. I was thing i can read pressureAvg[24] when i wrote static float pressureAvg[24][3];. Thank you for help.