Yes, I know that C enums are more flexible than Pascal enums in this way. I should have been clearer and asked for a way to get the highest value in an enum, rather than the number of elements. Then you could have something like:
typedef enum { red, green, blue } colours; unsigned long int colourValues[highestof(colours) + 1];
although the syntax
unsigned long int colourValues[colours];
would be far better, especially if there were any typechecking. Similarly, highestof() could be used when looping through all elements of an enum, or for run-time range-checking of enum values.
When using enums with holes, or non-zero first elements, then the validity of highestof() depends on the code - compiler warnings could be useful here.
Of course, this can all be done at the moment by defining "colours" as:
typedef enum { red, green, blue, noOfColours } colours;
but it would be more elegant to be able to have such compile-time type information in a consistent manner.