当前位置:网站首页>[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;
边栏推荐
- 27io stream, byte output stream, OutputStream writes data to file
- 清除浮动的方式
- Summary of deep learning tuning tricks
- 【华为机试真题详解】统计射击比赛成绩
- What is independent IP and how about independent IP host?
- 类和对象(一)this指针详解
- Text classification still stays at Bert? The dual contrast learning framework is too strong
- 01. Project introduction of blog development project
- [detailed explanation of Huawei machine test] check whether there is a digital combination that meets the conditions
- Codeless June event 2022 codeless Explorer conference will be held soon; AI enhanced codeless tool launched
猜你喜欢

移植InfoNES到STM32

Vulhub vulnerability recurrence 72_ uWSGI

CoDeSys note 2: set coil and reset coil

MIT6.s081-2020 Lab2 System Calls

嵌入式面试题(四、常见算法)

大型网站如何选择比较好的云主机服务商?

Redis消息队列

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

Application Security Series 37: log injection

Self built DNS server, the client opens the web page slowly, the solution
随机推荐
Market development prospect and investment risk assessment report of China's humidity sensor industry from 2022 to 2028
[force buckle]43 String multiplication
Station B Liu Erden linear regression pytoch
Web Security (VI) the use of session and the difference between session and cookie
LeetCode_ String inversion_ Simple_ 557. Reverse word III in string
通讯录管理系统链表实现
59. Spiral matrix
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
PDK process library installation -csmc
Demander le Code de texte standard correspondant à un centre de travail dans l'ordre de production
RustDesk 搭建一个自己的远程桌面中继服务器
Jushan database appears again in the gold fair to jointly build a new era of digital economy
【SQL server速成之路】——身份驗證及建立和管理用戶賬戶
SequoiaDB湖仓一体分布式数据库2022.6月刊
Yunxiaoduo software internal test distribution test platform description document
算法-- 爬楼梯(Kotlin)
First knowledge database
wib3.0 跨越,在跨越(ง •̀_•́)ง
Practice sharing: how to safely and quickly migrate from CentOS to openeuler
B站刘二大人-线性回归及梯度下降