当前位置:网站首页>[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;
边栏推荐
- Deep learning -yolov5 introduction to actual combat click data set training
- [machine learning notes] univariate linear regression principle, formula and code implementation
- Auto. JS learning notes 17: basic listening events and UI simple click event operations
- Station B Liu Erden linear regression pytoch
- 入侵检测领域数据集总结
- 无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
- [JVM] [Chapter 17] [garbage collector]
- How to get list length
- Promise summary
- Game push: image / table /cv/nlp, multi-threaded start!
猜你喜欢

H3C防火墙RBM+VRRP 组网配置

C language learning notes (mind map)

初识数据库

华为BFD的配置规范

Report on market depth analysis and future trend prediction of China's arsenic trioxide industry from 2022 to 2028

01. Project introduction of blog development project

类和对象(一)this指针详解
![[JVM] [Chapter 17] [garbage collector]](/img/f4/e6ff0e3edccf23399ec12b7913749a.jpg)
[JVM] [Chapter 17] [garbage collector]

Redis message queue
![[happy Spring Festival] if you feel happy, dance](/img/b5/faa4cb94ef5fb45b8bb98ecb69962f.jpg)
[happy Spring Festival] if you feel happy, dance
随机推荐
Construction of yolox based on paste framework
Station B Liu Erden linear regression pytoch
Algorithm -- climbing stairs (kotlin)
Mysql database master-slave cluster construction
Sword finger offer II 039 Maximum rectangular area of histogram
[detailed explanation of Huawei machine test] check whether there is a digital combination that meets the conditions
[detailed explanation of Huawei machine test] statistics of shooting competition results
养了只小猫咪
实践分享:如何安全快速地从 Centos迁移到openEuler
01. Project introduction of blog development project
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
[happy Spring Festival] if you feel happy, dance
嵌入式面试题(一:进程与线程)
59. Spiral matrix
[JVM] [Chapter 17] [garbage collector]
Demander le Code de texte standard correspondant à un centre de travail dans l'ordre de production
Codeless June event 2022 codeless Explorer conference will be held soon; AI enhanced codeless tool launched
LeetCode_ String inversion_ Simple_ 557. Reverse word III in string
无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
B站刘二大人-反向传播