I\'m implementing a card game in C. There are lots of types of cards and each has a bunch of information, including some actions that will need to be individually scripted assoc
Your approach is exactly right.
switch
statements.extern
is what you want, not static
. Change your body to be this:
struct CARD cardDefinitions[] = {
{0, 1, do_card0},
{1, 3, do_card1}
};
then in an appropriate header file:
extern struct CARD cardDefinitions[];