Infinite arrays

How can I declare an array without a definite number of addresses? Are there any limitations?

You can't have an infinite array until you find a computer with an infinite amount of storage.

There are various ways of dynamically allocating array sizes but it's fairly complex and fairly dangerous. Google "Arduino dynamic array" and be prepared for some reading.

Steve

muddie:
How can I declare an array without a definite number of addresses? Are there any limitations?

An array has only one address and that is the address of the beginning of the array. The memory of your Arduino is the limit. Why do you ask?

Paul

Paul_KD7HB:
An array has only one address and that is the address of the beginning of the array. The memory of your Arduino is the limit. Why do you ask?

Paul

Thank you, Paul. I'm looking for a way to store read sensor values. I actually only need to average the first ten to create a threshold value. The program is meant to produce an output when any of the remaining sensor values fall below the threshold.

Do you need an array at all, I wonder ?

Read each of the ten values and sum them as you go. When you have them all divide the total by 10 to get the average

UKHeliBob:
Do you need an array at all, I wonder ?

Read each of the ten values and sum them as you go. When you have them all divide the total by 10 to get the average

That does make a lot of sense, but I thought the previous value is cleared by the present one.

muddie:
That does make a lot of sense, but I thought the previous value is cleared by the present one.

I think your logic slipped a bit. You accumulate the sum in a variable you set up in your code.

Paul