当前位置:网站首页>The use of C language typedef 】 : structure, basic data types, and array
The use of C language typedef 】 : structure, basic data types, and array
2022-08-09 11:16:00 【XV_】
typedef basic data type
typedef int a;a abc;
The following a abc
is equivalent to int abc
typedef structure
typedefstruct a {int a;int b;}abc;abc aaa;
For the above, abc aaa;
is equivalent to struct a aaa;
In short, the essence of typedef is to build an equivalence relation.
The first example, let a
and int
be equivalent;
The second example, let abc
and struct a { int a; int b; };
equivalent;
This simplifies writing .
There are special cases, however, when using arrays.
typedef array
typedef int a[5];a aa;
Here a aa
is equivalent to int aa[5]
, where the essence of aa is array of int type with 5 elements.
That is to say, typedef int a[5];
, making a
equivalent to int[5]
, of course, C language does notThis way of writing, I hope to understand, a
represents an array with 5 elements of type int.
typedef struct desc_struct{unsigned long a, b;}desc_table[256];desc_table idt, gdt;
Here idt
is struct desc_struct idt[256]
, and the same is true for gdt
.
边栏推荐
猜你喜欢
fork创建多个子进程
End-to-End Object Detection with Fully Convolutional Network学习笔记
Qt获取EXE可执行文件的上一级目录下的文件
Qt读写.ini配置文件
Tensorflow realize parameter adjustment of linear equations
MySQL查询性能优化七种武器之索引潜水
人物 | 从程序员到架构师,我是如何快速成长的?
美的数字化平台 iBUILDING 背后的技术选型
Error: Cannot find module ‘./application‘
性能测试(05)-表达式和业务关联-json关联
随机推荐
gdb 10.2的安装
人物 | 从程序员到架构师,我是如何快速成长的?
C语言中信号函数(signal)的使用
PTA 换硬币
RPN principle in faster-rcnn
pip common commands and changing source files
gdb tui的使用
华为VRRP+MSTP联动接口检测实验案例
Looper 原理浅析
PTA习题 阶梯电价(C)
链表基本操作(详解)
C语言统计不同单词数
程序员的专属浪漫——用3D Engine 5分钟实现烟花绽放效果
PTA 矩阵运算
PTA 计算天数
Paper Sharing | ACL2022 | Argument Relation Extraction Based on Transfer Learning
golang源代码阅读,sync系列-Pool
Cluster understanding
获取指定年度所有周的工具类
Julia资料收集