Advertisement

Parse error in a pointer + strcuct table as a pointer?

Started by September 10, 2000 11:16 AM
1 comment, last by Afterlife 24 years, 3 months ago
struct CARD_RULES { struct CARD_RULES { char suit; int number; }; ... struct CARD_RULES cards[5]; textout_centre(screen,font, /**/ check_hand(cards[].suit,cards[].number) /**/ ,screen->w/2,screen->h/2,255); ... char *check_hand(char suit[5],int number[5]) { ... } My compiler says, that there is a parse error before '']'' in the line that starts with textout function. Whats this all about?!
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-
''cards'' is an array of 5 structs. To be able to reference a member of one of the structs, you need to tell the compiler which one of the 5 you want: cards[0].suit, cards[1].number, etc. If you want to use your function on all 5 cards, you''ll need to put the textout_centre call in some sort of loop.

I hope that helps,
Rob
Advertisement
''cards'' is an array of 5 structs. To be able to reference a member of one of the structs, you need to tell the compiler which one of the 5 you want: cards[0].suit, cards[1].number, etc. If you want to use your function on all 5 cards, you''ll need to put the textout_centre call in some sort of loop.

I hope that helps,
Rob

This topic is closed to new replies.

Advertisement