你好,我是这个C程序的新手 [英] Hello i am new to this C programs
问题描述
const struct
{
浮动a0;
浮动a1;
浮动a2;
} A_coeffs [SECTIONS];
i我很困惑宣布这个结构的价值正确我
thanq
i宣称这有编译错误
A_coeffs [] =
{
{1.254285,2.508570, 1.254285},
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
};
const struct
{
float a0;
float a1;
float a2;
}A_coeffs[SECTIONS];
i am confused to declare the value for this structure correct me
thanq
i have declared this there is compiler error
A_coeffs[]=
{
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
};
推荐答案
这将赋值为
跟随
a_coeffs [0] .a0 = 1.254285 ,
a_coeffs [0] .a1 = 2.508570,
a_coeffs [0] .a2 = 1.254285,
a_coeffs [1] .a0 = 1.254285,
a_coeffs [1] .a1 = 1.508570,
a_coeffs [1] .a2 = 1.254285,
这样它会继续
This will assign value as
follows
a_coeffs[0].a0=1.254285,
a_coeffs[0].a1=2.508570,
a_coeffs[0].a2=1.254285,
a_coeffs[1].a0=1.254285,
a_coeffs[1].a1=1.508570,
a_coeffs[1].a2=1.254285,
like this it will go on
文章< 11 ********************** @ g44g2000cwa.googlegroups .com>,siva
< si ********* @ gmail.com>写道
In article <11**********************@g44g2000cwa.googlegroups .com>, siva
<si*********@gmail.com> writes
const struct
浮动a0;
浮动a1;
浮动a2;
} A_coeffs [SECTIONS];
A_coeffs [] =
{
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
};
const struct
{
float a0;
float a1;
float a2;
}A_coeffs[SECTIONS];
A_coeffs[]=
{
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
};
差不多。
#define SECTIONS 3
const struct
{
浮动a0;
浮动a1;
浮动a2;
} A_coeffs [SECTIONS ] =
{
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
};
Nearly.
#define SECTIONS 3
const struct
{
float a0;
float a1;
float a2;
}A_coeffs[SECTIONS]=
{
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
{1.254285,2.508570,1.254285},
};
thanq
$ b $我给了我很好的解决方案
thanq
u have give me good solution
这篇关于你好,我是这个C程序的新手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!