Struct as argument


i have following struct:

struct key {
  int board;
  int value;
  int type;
};

and need create function

void assigntoboard(key &obj1, analogmultiplexer &obj2) {
  //this function assigns table object multiplexer board, every key mapped.
 
}

that receives array of struct objects , assigns analogmultiplexer object. problem when compile get:

zanella_launchpad:18: error: variable or field 'assigntoboard' declared void
zanella_launchpad:18: error: 'key' not declared in scope
zanella_launchpad:18: error: 'obj1' not declared in scope
zanella_launchpad:18: error: expected primary-expression before '&' token
zanella_launchpad:18: error: 'obj2' not declared in scope


but when take
void assigntoboard(analogmultiplexer &obj2) {

(without key object) compiles.
i don't understand i'm doing wrong since declared 'key' before void assigntoboard.

try putting struct header file , #include-ing it.  it's auto-generated function prototypes ide inserts that's causing error.


Arduino Forum > Using Arduino > Programming Questions > Struct as argument


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support