Arrays and vectors

I need to define an empty vector or array in my script. The size of the vector or array will increase over time.
Advice on how to do this?
Which libraries will I have to use?

Thanks!

On an AVR? Why not just declare the maximum size and only use what you need until it is full?

aarg:
On an AVR? Why not just declare the maximum size and only use what you need until it is full?

adding to that, you can also look at a Ring Buffer, which “expands” as you add values (though the size is predetermined).

Here is an example sketch:

#include "RingBuffer.h"

RingBuffer <float> ringBuffer(10);

void setup(void)
{
  Serial.begin(9600);
}

void loop(void)
{
  if(Serial.available())
  {
    float newValue = Serial.parseFloat();
    ringBuffer.addValue(newValue);
    Serial.print("Added:\t");
    Serial.print(newValue, 3);
    Serial.print("\tto array\tnew average:\t");
    Serial.println(ringBuffer.getAverage(), 3);
  }
}

and the library:

#ifndef RINGBUFFER_H
#define RINGBUFFER_H

#include "Arduino.h"

template < class Any_Type > class RingBuffer{
  public:
    RingBuffer(const size_t &size);
    void addValue(const Any_Type &value);
    Any_Type getAverage(void) const;
  private:
    Any_Type* myArray;
    size_t arraySize;
    uint32_t index;
    size_t numElements;
};

template < class Any_Type > RingBuffer < Any_Type >::RingBuffer(const size_t &size)
{
  arraySize = size;
  myArray = new Any_Type[size];
}

template < class Any_Type > void RingBuffer < Any_Type >::addValue(const Any_Type &value)
{

  if(++numElements > arraySize) numElements = arraySize;
  myArray[index++] = value;
  index %= arraySize;
}

template < class Any_Type > Any_Type RingBuffer < Any_Type >::getAverage(void) const
{
  Any_Type sum = 0;
  for(int i = 0; i < numElements; i++)
  {
    sum += myArray[i];
  }
  return (sum / numElements);
}
#endif