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 ;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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中初始化中的一个大错误
- 我似乎不能成功定义一个链表。我试过 typedef struct { char *item; NODEPTR next; } *NODEPTR; 但是编译器报了错误信息。难道在C语言中一个结构不能包
- 容易错误的一个初始化
- 一个登陆页面,包含了初始化用户,输入检测,错误处理等
- struct框架下启动一个项目出现404错误
- swift + 百度地图 初始化BMKMapView崩溃 不报错 无打印 (一个愚蠢的错误。。。)
- 测试连接失败,因为初始化提供程序试发生错误。发生了一个ORACLE错误,但无法从ORACLE中检索错误信息
- L2TP连接尝试失败,因为安全层在初始化与远程计算机的协商时遇到了一个处理错误
- win10系统 L2TP连接尝试失败:ERROR因为安全层在初始化与远程计算机的协商时遇到了一个处理错误
- 一个比较简单的错误,初始化后花屏。
- C++初始化列表问题,类中有一个对象类型的数组成员变量,在初始化列表中初始化时报错“[]”操作符语法错误
- win10系统 L2TP连接尝试失败:ERROR因为安全层在初始化与远程计算机的协商时遇到了一个处理错误
- 一个登陆页面,包含了初始化用户,输入检测,错误处理等
- Java Map初始化的一个错误:new HashMap().put("a", "b");
- 全局变量初始化相关的一个错误
- 一个犯了N久的错误