Your approach is exactly right.
- This will work, and is a good way to avoid huge
switchstatements. - You can’t define functions inline in C, they each must have a unique name.
-
externis what you want, notstatic. 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[];