当前位置:网站首页>【C language】typedef的使用:结构体、基本数据类型、数组
【C language】typedef的使用:结构体、基本数据类型、数组
2022-08-09 11:03:00 【XV_】
typedef基本数据类型
typedef int a;
a abc;
后面的a abc就等价于int abc
typedef结构体
typedef
struct a {
int a;
int b;
}
abc;
abc aaa;
对于上述,abc aaa;就等价于struct a aaa;
简而言之,typedef的本质,就是构建等价关系。
第一个例子,让a和int等价;
第二个例子,让abc和struct a { int a; int b; };等价;
这样一来,简化书写。
不过也有特别的例子,就是使用数组的时候。
typedef数组
typedef int a[5];
a aa;
这里a aa等价于int aa[5],这里aa的本质,是具有5个元素的int类型数组。
也就是说,typedef int a[5];,使得a与int[5]等价,当然C语言没有这样的写法,希望能够理解,a就是代表具有5个int类型元素的数组。
typedef struct desc_struct
{
unsigned long a, b;
}
desc_table[256];
desc_table idt, gdt;
这里idt就是struct desc_struct idt[256],gdt同理。
边栏推荐
- 七夕?程序员不存在的~
- 美的数字化平台 iBUILDING 背后的技术选型
- API接口是什么?API接口常见的安全问题与安全措施有哪些?
- 聚类了解
- [华为云在线课程][SQL语法分类][数据操作][学习笔记]
- torch.cat()函数的官方解释,详解以及例子
- Julia资料收集
- TensorFlow—计算梯度与控制梯度 : tf.gradients和compute_gradients和apply_gradients和clip_by_global_norm控制梯度
- caffe ---make all editing error
- PoseNet: A Convolutional Network for Real-Time 6-DOF Camera Relocalization论文阅读
猜你喜欢

CentOS6.5 32bit安装Oracle-11gR2步骤说明

去除蜂窝状的噪声(matlab实现)

Preparation for gold three silver four: how to successfully get an Ali offer (experience + interview questions + how to prepare)

∘(空心的点乘)的数学含义

Jmeter BeanShell post processor

自从我使用HiFlow场景连接器后,在也不用担心成为“落汤鸡”了

OpenSSF的开源软件风险评估工具:Scorecards

linux mysql操作的相关命令

jmeter BeanShell 后置处理器

聚类了解
随机推荐
详细的np.matmul / np.dot / np.multiply / tf.matmul / tf.multiply / *
golang runtime Caller、Callers、CallersFrames、FuncForPC、Stack作用
去除蜂窝状的噪声(matlab实现)
性能测试(03)-JDBC Request
聚类了解
focusablejs
PTA 求一批整数中出现最多的个位数字
golang 三种指针类型具体类型的指针、unsafe.Pointer、uintptr作用
备份mongodb数据库(认证)
MATLAB中如何把cftool拟合的函数输出到命令行(解决如何导出拟合后的曲线数据)
Solve 1. tensorflow runs using CPU but not GPU 2. GPU version number in tensorflow environment 3. Correspondence between tensorflow and cuda and cudnn versions 4. Check cuda and cudnn versions
cnn的输入输出
leetcode-搜索旋转排序数组-33
1003 Emergency (25分)
PTA习题 三角形判断
性能测试(01)-jmeter元件-线程组、调试取样器
Cluster understanding
PTA 找出不是两个数组共有的元素
threejs+shader 曲线点运动,飞线运动
为什么组合优先于继承