What is wrong in that code ?
I get error “Semantic Issue: Passing ‘cards [3]’ to parameter of incompatible type ‘cards'”
#include <stdio.h>
typedef struct {
char *name;
int sequence
} cards;
void print_deck(cards data);
int main (int argc, const char * argv[])
{
cards deck[] =
{
{"Heart", 1},
{"Arrow", 2},
{"Spatiq", 3}
};
print_deck(deck);
return 0;
}
void print_deck(cards data) {
}
You’re trying to pass
deck, which is an array of cards, to a function with a parameter of typecards. Those are two different types. You probably want to change the type of the parameter in theprint_deckfunction. I’d also suggest renaming thecardstype as it’s only actually a single card.