[SOLVED] problem with array, reading analogic values

Hi all! I'm in trouble with an array that reads analogic values from a NTC sensor. I've tried this sketch with an array that i've defined (it's commented in the code) and it works. But i want to read the values (ten) from ntc and so i read these values then i remove the two higher and the two lowest values; then i compute the mean with the six remaining integer:

int n = 0;
int i = 0;

void setup()
{
pinMode(n, INPUT);
Serial.begin(9600);
}

void loop()
{
int arraysala[10];// = {462, 462, 461, 462, 462, 461, 462 ,462, 462, 461};

int valore = analogRead(0);
Serial.print("read value ");
Serial.print(valore);
arraysala[i] = valore;
Serial.print(" array index number ");
Serial.print(i);
Serial.print(" save ");
Serial.println(arraysala[i]);
i = i+1;

if(i>9){
 
 
  Serial.print("printing the array ");
  for(int l = 0 ; l<10; l++){
    Serial.print("index ");
    Serial.print(l);
    Serial.print(" we got ");
    Serial.println(arraysala[l]);
  }
 
  int indmin = 0;
  int indmax = 0;
  int vmax = arraysala[0];
  int vmin = arraysala[0];
  for(int j = 1; j<=2; j++){
    for(int k = 0; k<10; k++){
      if(vmax <= arraysala[k] && arraysala[k] != 10000){
        vmax = arraysala[k];
        indmax = k;
      }
    }
    Serial.print("max ");
    Serial.println(indmax);
    arraysala[indmax] = -10000;
  }
 
  for(int j = 1; j<=2; j++){
    for(int k = 0; k<10; k++){
      if(vmin >= arraysala[k] && arraysala[k] != -10000){
        vmin = arraysala[k];
        indmin = k;
      }
    }
    Serial.print("min ");
    Serial.println(indmin);
    arraysala[indmin] = 10000;
  }
  i = 0;
  float media = 0;
  for(int l = 0 ; l<10; l++){
    media = arraysala[l] + media;
  }
  media = media / 6;
  Serial.print("mean = ");
  Serial.println(media);
}

delay(1000);
}

there is a problem. this is the output:

read value 528 array index number 0 save 528
read value 528 array index number 1 save 528
read value 528 array index number 2 save 528
read value 528 array index number 3 save 528
read value 528 array index number 4 save 528
read value 528 array index number 5 save 528
read value 528 array index number 6 save 528
read value 528 array index number 7 save 528
read value 528 array index number 8 save 528
read value 527 array index number 9 save 527
printing the array index 0 we got 528
index 1 we got 528
index 2 we got 528
index 3 we got 528
index 4 we got 528
index 5 we got 528
index 6 we got 16
index 7 we got -16128
index 8 we got -30464
index 9 we got 527
max 5
max 4
min 8
min 8
mean = -3912.17

actually in position 6 7 and 8 there is a mistake: arduino read 528 528 and 528, it stores these values and then when i want to see which values are stored into the array it says that in position 6 7 and 8 there are 16, -16128 and -30464! it sounds strange and i don't understand what happens...any ideas?

Shouldn't your array be qualified "static"?

AWOL:
Shouldn't your array be qualified "static"?

What does it means? I've never heard about that!

Your array is an automatic within "loop()".
As soon as "loop ()" returns, the array is no longer in scope, so next time "loop()" gets called, you cannot guarantee that anything you wrote to your array as still there.

AWOL:
Your array is an automatic within "loop()".
As soon as "loop ()" returns, the array is no longer in scope, so next time "loop()" gets called, you cannot guarantee that anything you wrote to your array as still there.

Yes, i've thought something similar was happening but i didn't know if I was right or not. The values that changed always in the same positions didn't help me in understanding the problem but now that you are telling me this...i've understand! Using "static" i guarantee that the array is the same for each loop until i clear it?
Thank you! (and sorry for the bad english!)