不确定是什么造成了这种情况,我在google上发现的只是在我的结构末尾忘记了一个分号导致了这个,但我有一个。
这是代码块......
#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];
};
答案 0 :(得分:5)
枚举也需要分号。