Yes your code works
void myProc (int& a, int& b) {
a = 2;
b = 7;
}
int myA = 0; //Belt AND braces.
int myB = 0;
void setup () {
myProc (myA, myB);
Serial.begin (9600);
Serial.println (myA);
Serial.println (myB);
}
void loop () {
}
but this one doesn't int myA = 0; //Belt AND braces.
int myB = 0;
void setup () {
myProc (myA, myB);
Serial.begin (9600);
Serial.println (myA);
Serial.println (myB);
}
void loop () {
}
void myProc (int& a, int& b) {
a = 2;
b = 7;
}
The IDE does not generate a prototype for functions that use arguments with reference parameters.
see:
http://code.google.com/p/arduino/issues/detail?id=205(please ignore that the OP of the google-code issue got the headline wrong)
Eberhard