Using typedef struct as a function parameter

I have a couple of structs that I'm using, which work fine, but I want to pass one through as a parameter of a function and I'm not sure how to do it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
typedef struct
{
	std::string move;
	int moveScore;
} moveOption;

typedef struct
{
	std::string pMove;
	moveOption option[POSSIBLEMOVES];
} moveDecision;


std::string ChooseBestMove(std::string pMove, moveDecision decision); //error here 


Any help would be appreciated.
You don't need to use typedefs like that in C++, but otherwise the code looks fine. What's the error?
I don't seem to be getting the error any more. I first got it when the structs were declared after the function, but I placed them before the function and still got the error (which was an undeclared identifier on the function). I must be confused. Sorry about that.

Out of curiosity though, why don't I need to pass typedefs as parameters?
He means that in C++ you don't need to put the typedef there at all; it is done for you automatically.

Ex:
1
2
3
4
5
6
struct arg {
  int x,y;
};

//later
arg some_arg_instance;
Ah right, I understand. Thanks.
closed account (zb0S216C)
See here: http://www.cplusplus.com/forum/beginner/89419/#msg480308

Wazzak
Topic archived. No new replies allowed.