Flo Flo - 1 year ago 121
C Question

error: expected primary-expression before ')' token (C)

I am trying to call a function named

characterSelection(SDL_Surface *screen, struct SelectionneNonSelectionne sel)
which returns a

This is the
of the function I try to call:

struct SelectionneNonSelectionne;
void characterSelection(SDL_Surface *screen, struct SelectionneNonSelectionne);
void resetSelection(SDL_Surface *screen, struct SelectionneNonSelectionne);

On my main function, I try to call it like this:

characterSelection(screen, SelectionneNonSelectionne);

When I compile, I have the message:

error: expected primary-expression before ')' token

I made the
. I suppose I miscall the second argument, my
. But, I can't find why on the net.

Have you got any idea about what I did wrong ?

Answer Source

You should create a variable of the type SelectionneNonSelectionne.

struct SelectionneNonSelectionne var;

After that pass that variable to the function like

characterSelection(screen, var);

The error is caused since you are passing the type name SelectionneNonSelectionne

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download