当前位置:网站首页>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
边栏推荐
- 否定语义转化层
- The solution to the height collapse problem
- 【LeetCode】Day112-repetitive DNA sequence
- 常用认证机制
- 80端口和443端口是什么?有什么区别?
- 21 Day Learning Challenge Week 1 Summary
- QueryDet: Cascading Sparse Query Accelerates Small Object Detection at High Resolution
- The "top pillar" slides, and new growth is extremely difficult to shoulder the heavy responsibility. Is Ali "squatting" to jump higher?
- The impact of programmatic trading and subjective trading on the profit curve!
- Typescript study notes | Byte Youth Training Notes
猜你喜欢
随机推荐
高校就业管理系统设计与实现
uni-app - 城市选择索引列表 / 通过 A-Z 排序的城市列表(uview 组件库 IndexList 索引列表)
Roewe imax8ev cube battery security, what blackening and swelling are hidden behind it?
Official release丨VS Code 1.70
获取链表长度
论文精度 —— 2017 CVPR《High-Resolution Image Inpainting using Multi-Scale Neural Patch Synthesis》
[idea error] Invalid target distribution: 17 solution reference
图解LeetCode——640. 求解方程(难度:中等)
程序化交易改变了什么?
一次简单的 JVM 调优,学会拿去写到简历里
索引的创建、查看、删除
Kubernetes集群搭建Zabbix监控平台
MYSQLg高级------回表
JS-DOM element object
音视频开发,为什么要学习FFmpeg?应该怎么入手FFmpeg学习?
互换性测量技术-几何误差
[BX]和loop
“顶梁柱”滑坡、新增长极难担重任,阿里“蹲下”是为了跳更高?
AI+医疗:使用神经网络进行医学影像识别分析
Idea (preferred) cherry-pick operation