Struct as argument

tgsuperspec:
Afraid your problems are because of misunderstanding of some fundamental C programming ideas.. or even programming ideas.

I have the following struct:

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

does not create a variable its a struct definition i.e how you want to group the data would advise you use..
form its more obvious for newbie..

typedef struct {
int board;
int value;
int type;
} key; // now it is obvious you have defined a new variable type but not the variable

key myKey; // now the variable mykey exist of type key

myKey.board = 9; // thats how to get to items inside notice the dot

Not strictly true. While that held true for C, C++ does the typedef of a struct for you.

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

key foo;

is perfectly acceptable in C++.