当前位置:网站首页>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
.
边栏推荐
猜你喜欢
随机推荐
去除蜂窝状的噪声(matlab实现)
详细的np.matmul / np.dot / np.multiply / tf.matmul / tf.multiply / *
【Subpixel Dense Refinement Network for Skeletonization】CVPR2020论文解读
PTA 求一批整数中出现最多的个位数字
enum in c language
UNIX哲学
Preparation for gold three silver four: how to successfully get an Ali offer (experience + interview questions + how to prepare)
Oracle数据库体系结构
pip common commands and changing source files
PTA 指定位置输出字符串(c)
bit、byte、KB、M、G、T相互关系
PTA习题 三角形判断
WebSocket
论文分享 | ACL2022 | 基于迁移学习的论元关系提取
torch.cat()函数的官方解释,详解以及例子
Product Quantization (PQ)
golang 三种指针类型具体类型的指针、unsafe.Pointer、uintptr作用
Multi-merchant mall system function disassembly 26 lectures - platform-side distribution settings
Create a table in a MySQL database through Doc
End-to-End Object Detection with Fully Convolutional Network学习笔记