您的位置:首页 > 编程语言 > C语言/C++

struct中初始化中的一个大错误

2015-04-09 00:00 183 查看
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 ;


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  C++C initialization struct