当前位置:网站首页>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
.
边栏推荐
猜你喜欢
随机推荐
性能测试(04)-表达式和业务关联-JDBC关联
UNIX Philosophy
PTA习题 三角形判断
TensorFlow: NameError: name 'input_data' is not defined
人物 | 从程序员到架构师,我是如何快速成长的?
ACM01背包问题
Qt 国际化翻译
PoseNet: A Convolutional Network for Real-Time 6-DOF Camera Relocalization Paper Reading
C语言统计不同单词数
【精华文】C语言结构体特殊情况分析:结构体指针 / 基本数据类型指针,指向其他结构体
图片查看器viewer
Product Quantization (PQ)
matlab fcnchk 函数用法
PTA习题 阶梯电价(C)
1008 Elevator (20分)
kubernetes中不可见的OOM
Invisible OOM in kubernetes
【VIBE: Video Inference for Human Body Pose and Shape Estimation】论文阅读
OC-NSTimer
End-to-End Object Detection with Fully Convolutional Network学习笔记