R
Rohit
Is there any way by which I can find number of elements in an enum
list?
Generally I use one last element at the end to find out total number
of elements. e.g.
typedef enum{
SUN,
MON,
TUE,
EndOfList
}weekdays;
But I am facing a situation in which I need to know number of elements
in an enum, which do not have
EndofList as its last element. For backward compatibility reasons I
can not change enum declaration which and add extra element.
In case of arrays I can use sizeof(array)/sizeof(array element
type)....But that wont work here....
Anybody has a solution??
Rohit
list?
Generally I use one last element at the end to find out total number
of elements. e.g.
typedef enum{
SUN,
MON,
TUE,
EndOfList
}weekdays;
But I am facing a situation in which I need to know number of elements
in an enum, which do not have
EndofList as its last element. For backward compatibility reasons I
can not change enum declaration which and add extra element.
In case of arrays I can use sizeof(array)/sizeof(array element
type)....But that wont work here....
Anybody has a solution??
Rohit