SouthernAtHeart:
So this would be fine:buttonPin[7] = {13,12,11,10,5,9,6};
Of course it should have a type, eg.
byte buttonPin[7] = {13,12,11,10,5,9,6};
And as maniacbug said, the compiler can figure out the size:
byte buttonPin[] = {13,12,11,10,5,9,6};
But if you need to know it, now you have to find it out, eg.
for (int i = 0; i < sizeof buttonPin; i++)
pinMode (buttonPin [i], OUTPUT);
That only works if the array happens to be of "unit" sized things (like byte, char).
Otherwise as lloyddean said, you have to divide by the unit size:
for (int i = 0; i < (sizeof buttonPin) / (sizeof buttonPin [0]); i++)
pinMode (buttonPin [i], OUTPUT);
I usually use a define to do that:
// number of items in an array
#define NUMITEMS(arg) ((unsigned int) (sizeof (arg) / sizeof (arg [0])))
So now you can do:
for (int i = 0; i < NUMITEMS (buttonPin); i++)
pinMode (buttonPin [i], OUTPUT);