help with enum

M.Fayezur Rahman sazib2000@yahoo.com
Wed Jun 22 14:09:00 GMT 2005


Hi Experts,
I was wondering if anyone could please tell me how to
set the size of a enum type. I think by default it is
long (4 bytes). I need to change it for a different
size, for example to int(2 bytes). 

typedef enum {sun=30000, mon, tues, wed, thurs} eTest;
int main(void)
{
	printf("Size is %d",sizeof(eTest));
	return 0;	
}

right now it would print out "Size is 4". I need to
configure it so that it treats enum as a 2 byte int,
therefore print "Size is 2".

Thanks in advance for your help
Raman

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Gcc-help mailing list