此错误应如何修改?
error:invalid types 'float' ' for array subscriptfloat propensity_granularity(float a, float b, float c)
{
float table =
{
{{0.0,0.0,0.0}, {0.0,0.0,0.1}, {0.1,0.1,0.2}},
{{0.1,0.1,0.2}, {0.2,0.3,0.4}, {0.4,0.5,0.6}},
{{0.4,0.5,0.6}, {0.5,0.6,0.7}, {0.8,0.9,1.0}},
{{0.9,0.9,1.0}, {1.0,1.0,1.0}, {1.0,1.0,1.0}}
};
return table;
} 下标索引不能是float类型,应该用unsigned int BngThea 发表于 2019-6-4 08:51
下标索引不能是float类型,应该用unsigned int
把table443前边的float改成unsigned int还是报错啊。小白一个,求指教 哈蛤哈 发表于 2019-6-4 09:09
把table443前边的float改成unsigned int还是报错啊。小白一个,求指教
他说的是括号里的形参a,b,c float propensity_granularity(int a, int b, int c)
{
float table =
{
{{0.0,0.0,0.0}, {0.0,0.0,0.1}, {0.1,0.1,0.2}},
{{0.1,0.1,0.2}, {0.2,0.3,0.4}, {0.4,0.5,0.6}},
{{0.4,0.5,0.6}, {0.5,0.6,0.7}, {0.8,0.9,1.0}},
{{0.9,0.9,1.0}, {1.0,1.0,1.0}, {1.0,1.0,1.0}}
};
return table;
}
int main()
{
float aa = propensity_granularity(2, 2, 1);
printf("%f", aa);
} VisionSo 发表于 2019-6-4 09:19
他说的是括号里的形参a,b,c
明白了
页:
[1]