当前位置:网站首页>【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同理。
边栏推荐
- PTA 找出不是两个数组共有的元素
- verbose np.matmul/np.dot/np.multiply/tf.matmul/tf.multiply/*
- b站up主:空狐公子 --矩阵求导(分母布局)课程笔记
- RPN principle in faster-rcnn
- 详细的np.matmul / np.dot / np.multiply / tf.matmul / tf.multiply / *
- 备战金三银四:如何成功拿到阿里offer(经历+面试题+如何准备)
- tensorflow实现线性方程的参数调整
- 学长告诉我,大厂MySQL都是通过SSH连接的
- grpc系列-初探grpc 路由注册和转发实现
- MySQL传统方案和通过SSH连接哪个好?
猜你喜欢
随机推荐
TensorFlow: NameError: name 'input_data' is not defined
STM32使用静态队列保存数据
Cesium加载三维模型数据
信息系统项目的十大管理
学习阶段总结(背包问题)
End-to-End Object Detection with Fully Convolutional Network学习笔记
PTA习题 分类统计字符个数(C)
Open3D 点云平均点间距评估
Multi-merchant mall system function disassembly 26 lectures - platform-side distribution settings
The torch. The stack () official explanation, explanation and example
获取指定年度所有周的工具类
日期工具类
性能测试(04)-表达式和业务关联-JDBC关联
Oracle数据库的两种进入方式
tensorflow和numpy对应的版本,报FutureWarning: Passing (type, 1) or ‘1type‘ as a synonym of type is deprecate
去除蜂窝状的噪声(matlab实现)
Since I use the HiFlow scene connector, I don't have to worry about becoming a "dropper" anymore
Antdv+Asp.net WebApi开发学生信息管理系统(一)
CSDN的markdown编辑器语法完整大全
caffe ---make all editing error









