当前位置:网站首页>typedef defines the structure array type
typedef defines the structure array type
2022-08-11 03:27:00 【family20102010】
PS: Typedef defines only an alias (or label) of type XX, which cannot be used directly as a variable, but can only be used to define a variable.
Example 1:
typedef struct st{char id;int num;char name[10];}DATA[10];//The DATA here is not an array, it only means an array type, which cannot be used in the programUse DATA[i] directlyDATA tmp;//It is equivalent to defining an array tmp[10], element type = structure st, which can be used directly in the programtmp[i]
Example 2:
typedef struct {word Head;word Length;byte PDUType;byte SRC_ID[10];byte DST_ID[10];byte PDUdata[200];}TReqFunReg, * PReqFunReg;Typedef TreqFunReg reg[100];//Note: The reg here only represents an array type, not an array. You cannot use reg[i] directly in the program. The correct usage is to use regDefine a variable, this variable is an array with 100 elements, and the element type is the structure TreqFunReg.TreqFunReg reg1[100];//This is the definition of a structure array (without Typedef modification), you can use reg1[i] directly in the programreg aaa; //equivalent to TreqFunReg aaa[100]; aaa[i] can be used directly in the program
边栏推荐
- MYSQLg高级------回表
- What problems should we pay attention to when building a programmatic trading system?
- 输入起始位置,终止位置截取链表
- What kind of programming trading strategy types can be divided into?
- The most unlucky and the luckiest
- How does MSP430 download programs to the board?(IAR MSPFET CCS)
- 添加用户报错useradd: cannot open /etc/passwd
- 没想到MySQL还会问这些...
- 高度塌陷问题的解决办法
- Idea (preferred) cherry-pick operation
猜你喜欢
多串口RS485工业网关BL110
A Practical Arrangement of Map GIS Development Matters (Part 1)
浮点数在内存中的存储方式
阿里低代码框架 lowcode-engine 之自定义物料篇
"How to kick a bad habit to read notes?
Summary of debugging skills
[yu gong series] Go program 035-08 2022 interfaces and inheritance and transformation and empty interface
你不知道的 console.log 替代品
Google search skills - programmer is recommended
索引的创建、查看、删除
随机推荐
分布式和集群的区别和联系
索引的创建、查看、删除
App基本框架搭建丨日志管理 - KLog
“顶梁柱”滑坡、新增长极难担重任,阿里“蹲下”是为了跳更高?
pathman_config、pathman_config_params 删除后,如何重建?
The thirteenth day of learning programming
Idea (preferred) cherry-pick operation
Summary of debugging skills
增加对 Textbundle 的支持
The solution to the height collapse problem
AI+医疗:使用神经网络进行医学影像识别分析
Official release丨VS Code 1.70
LeetCode热题(12.买卖股票的最佳时机)
Salesforce解散中国团队,什么样的CRM产品更适合中国人
常用认证机制
CSDN 博客更换皮肤
js中的this问题
Redis老了吗?Redis与Dragonfly性能比较
The impact of programmatic trading and subjective trading on the profit curve!
Realization of vending machine function based on FPGA state machine