我有一个结构访问一个枚举值的指针
struct abc
{
struct xyz *ptr1; int *a;
};
struct xyz
{
int *b;
enum __boolean *filter;
};
这里enum __boolean { false = 0; true = 1; };
我已经声明了一个指针struct abc *ptr
都做一个malloc,任何一个可以请告诉我如何访问值在枚举中,我想分配值。
我已经做了所有的结构
ptr->ptr1->filter = ?
如何访问枚举,我希望把零值出现的一个malloc。
是否有一个特定的原因,你想使用枚举的指针?它似乎使事情过于复杂。现在C有一个内置的布尔类型:'_Bool'。或者你可以使用[''](http://en.wikibooks.org/wiki/C_Programming/C_Reference/stdbool.h)头文件。 –
我建议从stdbool.h中使用'bool',以使代码尽可能与C++兼容。 – Lundin
或只是'int' ... –