当前位置:网站首页>[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;
边栏推荐
- LeetCode_ String inversion_ Simple_ 557. Reverse word III in string
- B站刘二大人-反向传播
- B站刘二大人-线性回归及梯度下降
- 华为路由器如何配置静态路由
- 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
- Winter 2021 pat class B problem solution (C language)
- 无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
- 类和对象(一)this指针详解
- AUTOSAR从入门到精通番外篇(十)-嵌入式S19文件解析
- [cloud native] 3.1 kubernetes platform installation kubespher
猜你喜欢
无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
Vulhub vulnerability recurrence 72_ uWSGI
Migrate Infones to stm32
PDK process library installation -csmc
[happy Spring Festival] if you feel happy, dance
H3C V7版本交换机配置IRF
Yygh-11-timing statistics
Deep learning -yolov5 introduction to actual combat click data set training
[Jiudu OJ 07] folding basket
ArcGIS application foundation 4 thematic map making
随机推荐
Report on market depth analysis and future trend prediction of China's arsenic trioxide industry from 2022 to 2028
B站刘二大人-多元逻辑回归 Lecture 7
Embedded interview questions (I: process and thread)
What is independent IP and how about independent IP host?
[cloud native] 3.1 kubernetes platform installation kubespher
Self built DNS server, the client opens the web page slowly, the solution
Auto. JS learning notes 17: basic listening events and UI simple click event operations
(column 22) typical column questions of C language: delete the specified letters in the string.
Deep learning -yolov5 introduction to actual combat click data set training
通讯录管理系统链表实现
[JVM] [Chapter 17] [garbage collector]
H3C防火墙RBM+VRRP 组网配置
How can large websites choose better virtual machine service providers?
【SQL server速成之路】——身份驗證及建立和管理用戶賬戶
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
Station B Liu Erden softmx classifier and MNIST implementation -structure 9
授予渔,从0开始搭建一个自己想要的网页
Clear floating mode
28io stream, byte output stream writes multiple bytes
Migrate Infones to stm32