Jump to content

Recommended Posts

Using BoostC version 6.85 should I be able to initialize the following structure?


const struct {
unsigned char NAME[4];
unsigned char DAYS;
} MONTH[13] =  {
	"   ", 29, 
	"Jan", 31,
	"Feb", 28,
	"Mar", 31,
	"Apr", 30,
	"May", 31,
	"Jun", 30,
	"Jul", 31,
	"Aug", 31,
	"Sep", 30,
	"Oct", 31,
	"Nov", 30,
	"Dec", 31


The above approach results in "error: can't assign string to 'struct' variable."


Help or pointers will be appreciated.


Thank you,

Carl Petito

Share this post

Link to post
Share on other sites

Complex initialisation like you use is not supported in current BoostC release. We plan to add support for it in the coming release. Meanwhile the workaround is to initialise variables outside of declaration like:


strcpy( MONTH[1].NAME, "Jan" );
MONTH[1].DAYS = 31;




Share this post

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...