my doubt is a general C doubt.. we know if we are using enum the variables which we declare inside automatically increments by one than the previous variable.. but is there any method by which we could make the variables to decrement by one instead of incrementing...
Example
enum my_enum { var1=90, var2,var3 };
for this code var2 and var3 will be 91 & 92 respectively, is there any method (possible) to get them 89 & 88... It was asked in an interview.. any one knows the answer..?
I read your original text as if the 'b' qualifier was required for the C51 architecture, but that the 'd' should be used for all architectures.
My original intention was that the entire comment was applicable to C51, by 'general' I meant that 'd' and a cast to int would work whichever type (char or int) C51 chose to use for the enumeration type.
However, it seems that the standard requires the enumeration constants to be of type int, so this would suggest to me that the enumeration type itself will only hold values representable as type int (although it may be capable of a wider or narrower range), irrespective what actual integer type is chosen for the enumerated type, or rather, what integer type the enumerated type is 'compatible with'. If my interpretation is correct I would therefore suggest that this:
//y is a variable of an enumerated type printf("%d\n",(int)y);
is a general solution outwith C51.
My preference is to avoid enum altogether as it provides a level of abstraction that I don't particularly want.