0
我有以下代碼:如何枚舉類型搜索用C
typedef enum Types{
Type_1, Type_2, Type_3
} MyTypes;
typedef union Tree{
struct {
int MyType;
}structAccessor;
} MyTree;
和我創建樹是這樣的:
MyTree* node(MyTypes MyType).......//folowwing is unnecessary
,我想知道我可以找到這樣我的樹,什麼類型:
if(node->structAccessor.MyType == MyTypes[2]) //if MyType is Type_2, i want to compare this, thanks so much