You could do it the way you suggested if you overload the pinMode function ]
void pinMode(unsigned int pinA, unsigned int pinB, unsigned int mode)
{
pinMode(pinA,mode);
pinMode(pinB,mode);
}
void pinMode(unsigned int pinA, unsigned int pinB, unsigned int pinC, unsigned int mode)
{
pinMode(pinA,mode);
pinMode(pinB,mode);
pinMode(pinC,mode);
}
... etc ...
Or re-write the pinMode function so it uses variable arguments (as printf does)
Note that using a for loop is not faster than individual statements. In fact, it might be slower, because of the overhead of the loop. It is shorter, though, in terms of the number of lines of code.
If you really meant faster, then you need to look at direct port manipulation.
In fact, it might be slower, because of the overhead of the loop
That depends on optimization.
-funroll-loops (part of -O2 iirc) will convert it to individual calls to the pinMode function with static values. Makes for bigger code, but faster execution.