当前位置:网站首页>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.
边栏推荐
- 华为VRRP+MSTP联动接口检测实验案例
- 二叉树 前序是根在前(根左右)中序(左根右)
- MATLAB中如何把cftool拟合的函数输出到命令行(解决如何导出拟合后的曲线数据)
- PoseNet: A Convolutional Network for Real-Time 6-DOF Camera Relocalization Paper Reading
- 人物 | 从程序员到架构师,我是如何快速成长的?
- 多商户商城系统功能拆解26讲-平台端分销设置
- 性能测试(05)-表达式和业务关联-json关联
- 最长回文子串
- 依赖注入(Dependency Injection)框架是如何实现的
- CentOS6.5 32bit安装Oracle-11gR2步骤说明
猜你喜欢
随机推荐
centos7.5 设置Mysql开机自启动
activemq message persistence
详细的np.matmul / np.dot / np.multiply / tf.matmul / tf.multiply / *
UNIX哲学
STM32使用静态队列保存数据
【C language】typedef的使用:结构体、基本数据类型、数组
grpc系列-初探grpc 路由注册和转发实现
电磁场与电磁波-场论基础
程序员的专属浪漫——用3D Engine 5分钟实现烟花绽放效果
ACM最长不下降子序列问题
The complete grammar of CSDN's markdown editor
OC-块对象
x86异常处理与中断机制(3)中断处理过程
activemq 消息持久化
ICML 2022 | Out-of-Distribution Detection with Deep Nearest Neighbors
∘(空心的点乘)的数学含义
【Subpixel Dense Refinement Network for Skeletonization】CVPR2020论文解读
性能测试(01)-jmeter元件-线程组、调试取样器
Looper 原理浅析
UNIX Philosophy









