当前位置:网站首页>[C language syntax] the difference between typedef struct and struct
[C language syntax] the difference between typedef struct and struct
2022-07-06 05:47:00 【Python's path to immortality】
typedef It means type definition .
typedef struct It's for the convenience of using this structure .
The specific difference is :
if struct node{ } If you define the structure in this way . In defining node Structure variable of , It needs to be written like this :struct node n;
If use typedef, It can be written like this :typedef struct node{}NODE; . You can write this when applying for variables :NODE n; It's the same thing as NODE yes node Another name for . The difference is that when used , Can you omit struct This keyword .
.
.
.
.
Example
If you use typedef Words , Will make a difference :
struct Student
{
int no;
char name[12];
}stu1;//stu1 Is a global variable created
typedef struct Student2
{
int no;
char name[12];
}stu2;//stu2 It's a structural type , namely stu2 yes Student2 Another name for
You can directly access stu1.no
however stu2 You must first define stu2 s2;
then s2.no=10;
边栏推荐
- [Tang Laoshi] C -- encapsulation: classes and objects
- 59. Spiral matrix
- 华为路由器如何配置静态路由
- [JVM] [Chapter 17] [garbage collector]
- Vulhub vulnerability recurrence 72_ uWSGI
- 清除浮动的方式
- Detailed summary of SQL injection
- Jushan database appears again in the gold fair to jointly build a new era of digital economy
- B站刘二大人-多元逻辑回归 Lecture 7
- H3C防火墙RBM+VRRP 组网配置
猜你喜欢
Clear floating mode
CoDeSys note 2: set coil and reset coil
网络协议模型
continue和break的区别与用法
H3C V7版本交换机配置IRF
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
ArcGIS application foundation 4 thematic map making
ArcGIS应用基础4 专题图的制作
局域网同一个网段通信过程
Download, install and use NVM of node, and related use of node and NRM
随机推荐
嵌入式面试题(一:进程与线程)
RustDesk 搭建一个自己的远程桌面中继服务器
华为路由器如何配置静态路由
【华为机试真题详解】检查是否存在满足条件的数字组合
AUTOSAR from getting started to becoming proficient (10) - embedded S19 file analysis
B站刘二大人-数据集及数据加载 Lecture 8
Station B, Master Liu Er - back propagation
养了只小猫咪
26file filter anonymous inner class and lambda optimization
Application Security Series 37: log injection
Migrate Infones to stm32
类和对象(一)this指针详解
自建DNS服务器,客户端打开网页慢,解决办法
Embedded interview questions (I: process and thread)
Classes and objects (I) detailed explanation of this pointer
Memory and stack related concepts
查询生产订单中某个(些)工作中心对应的标准文本码
wib3.0 跨越,在跨越(ง •̀_•́)ง
Web服务连接器:Servlet
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower