当前位置:网站首页>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
边栏推荐
猜你喜欢
多商户商城系统功能拆解26讲-平台端分销设置
互换性与测量技术-公差原则与选用方法
[DB operation management/development solution] Shanghai Daoning provides you with an integrated development tool to improve the convenience of work - Orange
基于改进YOLOv5轻量化的烟火检测
leetcode: 358. Reorder strings at K distance intervals
AI+Medical: Using Neural Networks for Medical Image Recognition and Analysis
大马驮2石粮食,中马驮1石粮食,两头小马驮一石粮食,要用100匹马,驮100石粮食,如何分配?
EasyCVR接入海康大华设备选择其它集群服务器时,通道ServerID错误该如何解决?
A practice arrangement about map GIS (below) GIS practice of Redis
CSDN blog replacement skin
随机推荐
互换性与测量技术-公差原则与选用方法
Add support for Textbundle
调试技巧总结
[ADI low-power 2k code] Based on ADuCM4050, ADXL363, TMP75 acceleration, temperature detection and serial port printing, buzzer playing music (lone warrior)
[BX] and loop
索引的创建、查看、删除
C语言 recv()函数、recvfrom()函数、recvmsg()函数
基于改进YOLOv5轻量化的烟火检测
获取链表长度
Add user error useradd: cannot open /etc/passwd
The 125th day of starting a business - a note
AI+Medical: Using Neural Networks for Medical Image Recognition and Analysis
JS-DOM element object
The impact of programmatic trading and subjective trading on the profit curve!
7 sorting algorithms that are often tested in interviews
DNS分离解析和智能解析
The solution to the height collapse problem
Summary of debugging skills
DOM-DOM tree, a DOM tree has three types of nodes
KingbaseES有什么办法,默认不读取sys_catalog下的系统视图?