update
You made the fixes to you code correctly based on the initial answer but you just have a typo which once you fix will give you clean code:
int isXOfAKind(card*, int, enum pips);
^^^^
should be:
int isXOfAKind(card*, int, enum pip);
^^^
here as well:
int isXOfAKind(card *hand, int x, enum pips pip) {
^^^^^^^^
should be:
int isXOfAKind(card *hand, int x, enum pip pips) {
^^^^^^^^
Original answer
The problem is that pips
is a variable not a type here:
enum {ACE=1, TWO, ... } pips;
^^^^
This would create a type pips:
enum pips {ACE=1, TWO, } myPip;
^^^^
See the following sample live:
#include <stdio.h>
typedef struct card {
enum pips {ACE=1, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING} myPip;
enum {SPADES, CLUBS, HEARTS, DIAMONDS} suit;
char cardName[20];
} card;
void test( enum pips pip) {
printf( "pip = %d\n", pip ) ;
}
int main()
{
test( TWO ) ;
test( KING ) ;
}
If we go to the draft C99 standard we see in section 6.7.2.3
Tags paragraph 6 says (emphasis mine):
type specifier of the form
struct-or-union identifieropt { struct-declaration-list }
or
enum identifieropt { enumerator-list }
or
enum identifieropt { enumerator-list , }
declares a structure, union, or enumerated type. The list defines the structure content, union content, or enumeration content. If an identifier is provided,130) the type specifier also declares the identifier to be the tag of that type.
where footnote 130
says:
If there is no identifier, the type can, within the translation unit, only be referred to by the declaration of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations can make use of that typedef name to declare objects having the specified structure, union, or enumerated type.