多个参数怎么转成数组
多个参数如何转成数组?
如图这样作会报错,请兄弟们指教...
const float* ppp1 = kkk[0];
const float* ppp2 = kkk[1];
const float* ppp3 = kkk[2];
const float* ppp4 = kkk[3];
---------
const float* ppp36 = kkk[35];
int xhgs = 36;
const float* ppp[xhgs]={0};
for( int w = 0; w < xhgs ; w++)
{ ppp[w] = kkk[w];
}
-----------------------------------------------------
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2440: '=' : cannot convert from 'const float *const ' to 'const float'
------解决方案--------------------
把const这个修饰符去掉
------解决方案--------------------
俺脚着直接用宏定义更方便。
------解决方案--------------------
如图这样作会报错,请兄弟们指教...
const float* ppp1 = kkk[0];
const float* ppp2 = kkk[1];
const float* ppp3 = kkk[2];
const float* ppp4 = kkk[3];
---------
const float* ppp36 = kkk[35];
int xhgs = 36;
const float* ppp[xhgs]={0};
for( int w = 0; w < xhgs ; w++)
{ ppp[w] = kkk[w];
}
-----------------------------------------------------
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2440: '=' : cannot convert from 'const float *const ' to 'const float'
------解决方案--------------------
把const这个修饰符去掉
------解决方案--------------------
俺脚着直接用宏定义更方便。
------解决方案--------------------
- C/C++ code
int xhgs = 36;
------解决方案--------------------
xhgs必须是常量才能使
楼上正解
const float* ppp[xhgs]={0};
合法