I was wondering if there is any way to pass an integer to a function which expects a enum type.
I need to use this function: void SetValue(enumtypevalue){ variable = value} that was made by a work mate and the enum is something like:
typedef enum
{
Obj1 = 0,
Obj2 = 1,
...
Objn = m,
}enumtype;
The thing is that this function is on a library I use in my program and there I know the number of the enum but not the name (Obj1, Obj2...) so I was wondering if its possible to do something like SetValue(4) instead of SetValue(Obj1)so my mate doesn't have to overwritte/change it and I don't have to hardcode all the enum (which is not small).
I know it sounds so stupid to pretend pass one type instead of another but if you pass 'Obj1' to the function its like saying '0' because they are related so that's why I make this 'fool' question.
Thanks.
enuminstead of structure?