问题描述
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},
};
推荐答案
差不多。
#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},
};
这篇关于你好,我是这个C程序的新手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!