bearophile дµ½:
> westcity Wrote:
> > But, the compiler report "Error: array initializers as expressions are not
> > allowed".
> > Then, how do I initialize an array of struct ?
>
> Move the definition out of main (note that ; after the struct isn't required):
>
> struct Point {
> float x
On 12.02.2009 15:16, Frits van Bommel wrote:
bearophile wrote:
westcity Wrote:
But, the compiler report "Error: array initializers as expressions are not
allowed".
Then, how do I initialize an array of struct ?
Move the definition out of main (note that ; after the struct isn't required)
bearophile wrote:
westcity Wrote:
But, the compiler report "Error: array initializers as expressions are not
allowed".
Then, how do I initialize an array of struct ?
Move the definition out of main (note that ; after the struct isn't required):
struct Point {
float x, y, z;
}
Point[3]
westcity Wrote:
> But, the compiler report "Error: array initializers as expressions are not
> allowed".
> Then, how do I initialize an array of struct ?
Move the definition out of main (note that ; after the struct isn't required):
struct Point {
float x, y, z;
}
Point[3] pts = [{1.0, 0.0
Frits van Bommel дµ½:
> westcity wrote:
> > My code is as following:
> >
> > struct Point {
> > float x, y, z ;
> > };
> >
> > int main ()
> > {
> > Point[3] pts = [
> > {1.0, 0.0, 0.0} ,
> > {0.0, 1.0, 0.0} ,
> > {0.0, 0.0, 1.0}
>
westcity wrote:
My code is as following:
struct Point {
float x, y, z ;
};
int main ()
{
Point[3] pts = [
{1.0, 0.0, 0.0} ,
{0.0, 1.0, 0.0} ,
{0.0, 0.0, 1.0}
];
return 0 ;
}
But, the compiler report "Error: array
My code is as following:
struct Point {
float x, y, z ;
};
int main ()
{
Point[3] pts = [
{1.0, 0.0, 0.0} ,
{0.0, 1.0, 0.0} ,
{0.0, 0.0, 1.0}
];
return 0 ;
}
But, the compiler report "Error: array initializers as ex