首页 > 代码库 > struct中初始化中的一个大错误
struct中初始化中的一个大错误
If I have defined the struct as follows :
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct MyParam : public CommonParam
{
float Image[1024];
int ImageType;
MyParam()
{
Image[1024]={0.0,0.0};
ImageType=10;
}
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
When I build it ,there are some errors ;
The reason is that :I confuse the initialization between declaring initialization and the struct initiazation ;Here ,we can‘t initialize the array Image[1024] by this way ;we are supposed to give evey value for the each element of the array ! That‘s just my error ;
struct中初始化中的一个大错误