不太确定是什么导致了这个问题,我在谷歌上发现的是,在我的结构末尾忘记了分号会导致这个问题,但我那里有一个。
这是代码块...
#include <stdio.h>
#include <string.h>
#define NAME_LENGTH 20
#define BOOK_NAME_LEN 50
#define AUTHOR_NAME_LEN 30
enum bookStatus {CHECKED_IN, CHECKED_OUT, UNDER_REPAIR, LOST}
enum patronStatus {ACTIVE, INACTIVE}
struct Book{
char title[BOOK_NAME_LEN];
char author[AUTHOR_NAME_LEN];
enum bookStatus status;
};
struct Name{
char first[NAME_LENGTH];
char last[NAME_LENGTH];
};
struct Patron{
int numBooksOut;
struct Name name;
struct Book books[50];
enum patronStatus status;
};
struct Collection{
struct Book book;
char title[BOOK_NAME_LEN];
char author[AUTHOR_NAME_LEN];
int id, year;
enum bookStatus status;
};
struct Library{
int totalPatrons, totalBooks;
struct Patron patrons[50];
struct Collection collection[50];
};
最佳答案
枚举也需要分号。
关于c - 结构 - 声明说明符中的两个或多个数据类型(我有分号),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7829115/