How to store values inside an empty array and get the average integer? [UPDATED QUESTION] Goodafternoon,

I want to read values form a microphone (Adafruit MAX9814) connected to the Analog port A0 from Arduino and store the values that are incoming inside an array. 

After the values are stored in the array, I want to read out the values and store the number that is repeated most time in a variable. Is this possible and how to achieve this?

I came up with the following:

const int micPin = A0;
int soundArray[10];

void setup() {

  Serial.begin(9600);
  pinMode(micPin, INPUT);

}

void loop() {

  int micValue = analogRead(micPin);
  Serial.println(micValue, DEC);
  //delay(400);

  for (int i = 0; i &gt; 10; i++) {
    soundArray[i] = micValue;
    Serial.println(soundArray[i]);
  }
  delay(1000);
  Serial.println("End of for loop");


}


The problem now is that a value of the microphone will be repeated 10 times. So I will receive 10 times the number 234 for example. See image.

This is not what I want. I want to get different numbers in the array of that moment.


Hope someone can help me out.
Thanks in advance.
The error message is correct. You did not define the size of the array.
You have 3 choices:


Declare it with a constant length

int foo[10];
Declare it and initalize it

int foo[] = {0,1,2,3,4,5,6,7,8,9};
Declare it dynamic as pointer and alloc or realloc the mem by yourself (this is not recommended (realloc) because of possible heap memory fragmentation)

int foo;
int size = 10;
foo = (int)malloc(size * sizeof(int));
free(foo);


As reference:
http://www.arduino.cc/en/pmwiki.php?n=Reference/Array