Also can I do something like:
Code:buttons[0,1,2,3,4,5,6,7,8,9,10,11].pin = 8,9,10,11,12,13,14,15,16,17,18;?
Not exactly, but you can do this:
buttons[] = { 8,9,10,11,12,13,14,15,16,17,18};
And it will be filled from the start (index 0), and to as many as needed.
In the case of a structure, you can do this:
struct aButton {
byte pin;
byte val;
byte state;
byte check;
};
// make a prefilled array structure called buttons with 2 elements
aButton buttons[] = { {1,2,3,4}, {5,6,7,8} };
For assigning, you can do this, as with any variable:
...
aButton anotherButton;
void something()
{
anotherButton = buttons[1]; // works, makes a copy of buttons[1].
... etc
}
But curiously, you cannot do comparisons, not even equal:
if (buttons[0] == anotherButton) Serial.print("they are alike!"); // will not work!
That would require to test each member (.pin, .val, .state, .check) at a time, it seems.