1) Wie schon erwähnt wurde kann C Referenzen in den Aufrufparametern verwenden.
2) Man kann sich ja beliebige Strukturen für die Rückgabeparameter definieren. Problem dabei ist nicht C sondern die schlecht gemachte Arduino IDE die meint Prototypen definieren zu müssen aber dabei typedefs nicht berücksichtigt. Ein Workaround ist TRICK17
http://blog.blinkenlight.net/2012/09/01/trick-17/, die andere Lösung die Verwendung von Namespaces, also so:
namespace example {
typedef struct {
int a;
int b;
int c;
} triple;
triple test(const int x, const int y, const int z) {
triple value;
value.a = x;
value.b = y;
value.c = z;
return value;
}
triple test2(const int x, const int y, const int z) {
return triple {x, y, z};
}
}
void setup() {
using namespace example;
const triple result = test(1,2,3);
const int x = result.a;
const int y = result.b;
const int z = result.c;
}
void loop() {}
test() und test2() haben das gleiche Verhalten sind aber einmal ausführlich und einmal kurz hingeschrieben.
Stattdessen globale Variablen zu verwenden ist nicht wirklich Stand der Technik.