IPB

Welcome Guest ( Log In | Register )

> Error When Initializing An Array Of Structures
gbgb
post Dec 11 2007, 04:20 PM
Post #1


Regular
*

Group: EstablishedMember
Posts: 36
Joined: 14-February 07
Member No.: 2,908



I have a structure:

typedef struct
{
unsigned int A;
unsigned int B;
unsigned int c;
} ConvertCoeff;

and I declare an array of this structure:

ConvertCoeff coeff[8];

As long as I leave it this way everything is OK.
But if I try to intialize the array during decleration as follows:

ConvertCoeff coeff[3] = { {1,2,3}, {1,2,3}, {1,2,3}};

I get an error during compilation - missing semicolon.

Is it not a legitimate initialization? I know it is possible on other compilers - how do I do it in BoostC?
update SourceBoost release 6.97 is available.
Download Now
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
Reynard
post Dec 11 2007, 09:09 PM
Post #2


Super Enthusiast
***

Group: EstablishedMember
Posts: 429
Joined: 24-October 07
From: Scotland
Member No.: 3,861



As you said it appears that BoostC does not like initialising structures like other compilers. sad.gif

You will have to fill your structure the hard way.

BoostC is still value for money and is still growing.

Cheers

Reynard

ps. MikroC works but you have to pay more.
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 3rd September 2010 - 02:49 PM