当前位置:网站首页>[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;
边栏推荐
- Market development prospect and investment risk assessment report of China's humidity sensor industry from 2022 to 2028
- 01. Project introduction of blog development project
- How to download GB files from Google cloud hard disk
- B站刘二大人-反向传播
- 27io stream, byte output stream, OutputStream writes data to file
- 授予渔,从0开始搭建一个自己想要的网页
- Application Security Series 37: log injection
- The digital economy has broken through the waves. Is Ltd a Web3.0 website with independent rights and interests?
- After the project is released, index Html is cached
- 通讯录管理系统链表实现
猜你喜欢
随机推荐
MIT6.s081-2020 Lab2 System Calls
Go language -- language constants
Download, install and use NVM of node, and related use of node and NRM
Station B, Master Liu Er - dataset and data loading
Game push: image / table /cv/nlp, multi-threaded start!
26file filter anonymous inner class and lambda optimization
[happy Spring Festival] if you feel happy, dance
Migrate Infones to stm32
Is it difficult for an information system project manager?
大型网站如何选择比较好的云主机服务商?
[Jiudu OJ 08] simple search x
Demander le Code de texte standard correspondant à un centre de travail dans l'ordre de production
LeetCode_字符串反转_简单_557. 反转字符串中的单词 III
[force buckle]43 String multiplication
H3C S5820V2_5830V2交换机IRF2堆叠后升级方法
【经验】win11上安装visio
[detailed explanation of Huawei machine test] check whether there is a digital combination that meets the conditions
网络协议模型
Web Security (VI) the use of session and the difference between session and cookie
Yygh-11-timing statistics