没有合适的资源?快使用搜索试试~ 我知道了~
首页typedef struct 与 struct 的区别及初始化
typedef struct 与 struct 的区别及初始化 typedef struct 与 struct 的区别及初始化 typedef struct 与 struct 的区别及初始化 typedef struct 与 struct 的区别及初始化 typedef struct 与 struct 的区别及初始化
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/2718049/bg1.jpg)
初始化例子
typedef struct PhotoInfo
{
CString csName;
CString csStoragePath;
CString csLocalPath;
CString csStorageBakPath; // the storage path of proccessed photo
CString csLocalBakPath; // the local path of proccessed photo
// 2009/03/12 Keiichi Yoshihara modified -start-
CString csCameraName;
bool bNewCreate;
// 2009/03/12 Keiichi Yoshihara modified -end-
HANDLE hImage;
HANDLE hImageProcessed;
LPBYTE pDataProcessed;
bool bRead;
bool bNeedUpdate;
bool bShown;
bool bConfirmed;
//ASDC for 補正済みコマ表示明確化 AS
bool bProcessed;
//ASDC for 補正済みコマ表示明確化 AE
ColorCorrection::CFColorData colorData;
vector<CString> vecSetupList;
ROTATEANGLE_e nRotate;
PhotoInfo()
{
csName = NULL_STRING;
csStoragePath = NULL_STRING;
csLocalPath = NULL_STRING;
csStorageBakPath = NULL_STRING;
csLocalBakPath = NULL_STRING;
// 2009/03/12 Keiichi Yoshihara modified -start-
csCameraName = NULL_STRING;
bNewCreate = false;
// 2009/03/12 Keiichi Yoshihara modified -end-
hImage = NULL;
hImageProcessed = NULL;
pDataProcessed = NULL;
bRead = false;
bNeedUpdate = false;
bShown = false;
bConfirmed = false;
vecSetupList.clear();
nRotate = e_Origin;
//ASDC for 補正済みコマ表示明確化 AS
bProcessed = false;
//ASDC for 補正済みコマ表示明確化 AE
colorData.m_nCyan = 0;
colorData.m_nMagenta = 0;
colorData.m_nYellow = 0;
colorData.m_nDensity = 0;
colorData.m_bSetup = 0;
colorData.m_nIndividualSetup = 0;
}
}PHOTOINFO_t;
typedef struct OrderInfo
{
CString csOrderId;
![](https://csdnimg.cn/release/download_crawler_static/2718049/bg2.jpg)
CString csLastAccessTime;
CString csOrderPath;
CString csOutOrderPath;
CString csErrOrderPath;
CString csStoragePath;
CString csLocalOrderPath;
CString csStorageColorPath;
CString csLocalColorPath;
bool bRead;
bool bFinished;
bool bFirstRead;
bool bConfirmed;
bool bErrorOrder;
//<--- 2009/03/31 FFS K.Yoshihara added
bool bNewCreate;
//2009/03/31 FFS K.Yoshihara added --->
vector <PHOTOINFO_t> photoVec;
OrderInfo()
{
csOrderId = NULL_STRING;
csLastAccessTime = NULL_STRING;
csOrderPath = NULL_STRING;
csOutOrderPath = NULL_STRING;
csErrOrderPath = NULL_STRING;
csStoragePath = NULL_STRING;
csLocalOrderPath = NULL_STRING;
csStorageColorPath = NULL_STRING;
csLocalColorPath = NULL_STRING;
bRead = false;
bFinished = false;
bFirstRead = true;
bConfirmed = false;
bErrorOrder = false;
bNewCreate = false;
}
}ORDERINFO_t;
1. 由于对 typedef 理解不够,因此从网上摘录了一些资料,整理如下:
2.
3. C/C++中 typedef struct 和 struct 的用法
4.
5. struct _x1 { ...}x1; 和 typedef struct _x2{ ...} x2; 有什么不同?
6.
7.
8. 其实, 前者是定义了类_x1 和_x1 的对象实例 x1, 后者是定义了类_x2 和_x2 的类别名 x2 ,
9.
10. 所以它们在使用过程中是有取别的.请看实例 1.
11.
12. [知识点]
13.
14. 结构也是一种数据类型, 可以使用结构变量, 因此, 象其它 类型的变量一样, 在使用结构变量时
要先对其定义。
15.
16. 定义结构变量的一般格式为:
17.
18. struct 结构名
19.
20. {
21.
22. 类型 变量名;
23.
![](https://csdnimg.cn/release/download_crawler_static/2718049/bg3.jpg)
24. 类型 变量名;
25.
26. ...
27.
28. } 结构变量;
29.
30. 结构名是结构的标识符不是变量名。
31.
32.
33.
34. 另一种常用格式为:
35.
36.
37.
38. typedef struct 结构名
39.
40. {
41.
42. 类型 变量名;
43.
44. 类型 变量名;
45.
46. ...
47.
48. } 结构别名;
49.
50.
51.
52.
53.
54. 另外注意: 在 C 中,struct 不能包含函数。在 C++中,对 struct 进行了扩展,可以包含函数。
55.
56.
57.
58. ======================================================================
59.
60.
61.
62. 实例 1: struct.cpp
63.
64.
65.
66. #include <iostream>
67.
68. using namespace std;
69.
70. typedef struct _point{
71.
72. int x;
73.
74. int y;
75.
76. }point; // 定义类,给类一个别名
77.
78.
79.
80. struct _hello{
81.
82. int x,y;
83.
84. } hello; // 同时定义类和对象
85.
86.
87.
剩余10页未读,继续阅读
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/1108789061674d9096d62152767f5d57_sdytdhl.jpg!1)
sdytdhl
- 粉丝: 22
- 资源: 94
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
会员权益专享
最新资源
- 基于嵌入式ARMLinux的播放器的设计与实现 word格式.doc
- 经典:大学答辩通过_基于ARM微处理器的嵌入式指纹识别系统设计.pdf
- 嵌入式系统课程设计.doc
- 基于飞思卡尔控制器的智能寻迹车设计ARM基础课程课程设计.doc
- 下载基于ARM7的压电陶瓷换能器导纳圆测量仪的研制PDF格式可编辑.pdf
- 课程设计基于ARM的嵌入式家居监控系统的研究与设计.doc
- 论文基于嵌入式ARM的图像采集处理系统设计.doc
- 嵌入式基于ARM9的中断驱动程序设计—课程设计.doc
- 在Linux系统下基于ARM嵌入式的俄罗斯方块.doc
- STK-MirrorStore Product Release Notes(96130)-44
- STK-MirrorStore Storage Connectivity Guide for StorageTek Disk A
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-本科毕业设计.doc
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-.doc
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-本科生毕业论文.doc
- 麻阳风貌展示网站的设计与实现毕业论文.pdf
- 高速走丝气中电火花线切割精加工编程设计.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)