Struct as argument

Because of where the IDE puts the prototypes.

If you have type "foo" in a header file "foo.h" and type "bar" defined in your sketch, and do something like:

#include "foo.h"

typedef struct {
  int a;
  int b;
} bar;

void setup() {
}

void loop() {
}

void foobar(foo &f, bar &b) {
}

what you actually end up with, after the inclusion of the header file and the munging by the IDE is:

typedef struct {
  int x;
  int y;
} foo;

void setup();
void loop();
void foobar(foo &f, bar &b);

typedef struct {
  int a;
  int b;
} bar;

void setup() {
}

void loop() {
}

void foobar(foo &f, bar &b) {
}

See how the prototype for foobar is before the definition of bar, but after the inclusion of foo, so it fails because of the bar, but the foo is ok.