Struct as argument

The "key" struct is before the

void assignToBoard(key &obj1, analogMultiplexer &obj2) {

which YOU put in, but it is AFTER the

void assignToBoard(key &obj1, analogMultiplexer &obj2);

that the IDE puts in.

When you compile your code the IDE generates a .cpp file in your "build" folder. Examine that folder and you'll see the .cpp file. Look at that .cpp file and all will become clear.