Hi Folks, I am using c18 in MPLAB for *PIC18F97J60 * and have created the following structure and enum union { struct { unsigned char Sun:1; unsigned char Mon:1; unsigned char Tue:1; unsigned char Wed:1; unsigned char Thu:1; unsigned char Fri:1; unsigned char Sat:1; unsigned char Try:1; } day; BYTE val; } days; typedef enum _WEEK_DAYS { SUN = 0, MON, TUE, WED, THU, FRI, SAT, TRY } WEEK_DAYS; I have a variable tm_wday which is the current day of the week 0 - 6 with 0 = Sunday. Currently the only way I can see to check the state of a bit in the "days" structure is with a case statement as follows:- switch(tm_wday) { case SUN: if (days.day.Sun) { do something } break; case Mon: if (days.day.Mon) { do something } break; ... etc I am sure I should be able to do something like if (days.day[tm_wday]) { do something } Is this possible? Cheers Justin -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist