TomF 0 Posted May 8, 2012 Report Share Posted May 8, 2012 Hi- Tried to use a member of a struct as an index into a string array. It doesnt work. See below; struct sTimeDate { unsigned char day; unsigned char month; unsigned char year; unsigned char hours; unsigned char mins; unsigned char secs; }; void TransmitTimeDate(bool bTxTime, bool bTxDate, struct sTimeDate* ptd) { char* pszMonths[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; unsigned char nMonth = ptd->month -1; COMMS_TransmitText( pszMonths[nMonth] ); // OK // COMMS_TransmitText( pszMonths[(ptd->month)-1] ); // doesnt work } Quote Link to post Share on other sites
TomF 0 Posted May 22, 2012 Author Report Share Posted May 22, 2012 bump Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.