1
袋implementation.h:當我嘗試聲明bag結構體時出錯?
typedef struct node {
struct node *next;
char *element;
int repeats;
} Node;
typedef struct{
size_t size;
Node *head;
}Bag;
線,在bag.c誤差(其包括bag.h其包括袋implementation.h):
Bag bag_union(Bag bag1, Bag bag2){
Bag union;
return bag1;
}
錯誤:
bag.c: In function 'bag_union':
bag.c:188:12: error: expected '{' before ';' token
bag.c:188:7: error: two or more data types in declaration specifiers
make: *** [bag.o] Error 1
如果我嘗試編譯而不創建那個包,那麼它工作正常。什麼是問題?
您不能有一個名爲'union'的變量。 –
lmao修復它謝謝你 – Jenny