当前位置:网站首页>[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;
边栏推荐
- [happy Spring Festival] if you feel happy, dance
- Pay attention to the details of pytoch code, and it is easy to make mistakes
- Implementation of linked list in address book management system
- Improve jpopup to realize dynamic control disable
- PDK process library installation -csmc
- 大型网站如何选择比较好的云主机服务商?
- SequoiaDB湖仓一体分布式数据库2022.6月刊
- Application Security Series 37: log injection
- AUTOSAR from getting started to becoming proficient (10) - embedded S19 file analysis
- 查詢生產訂單中某個(些)工作中心對應的標准文本碼
猜你喜欢
Game push image / table /cv/nlp, multi-threaded start
Station B, Master Liu Er - back propagation
Summary of deep learning tuning tricks
[email protected]树莓派"/>
[email protected]树莓派
What impact will frequent job hopping have on your career?
自建DNS服务器,客户端打开网页慢,解决办法
Analysis of grammar elements in turtle Library
Node 之 nvm 下载、安装、使用,以及node 、nrm 的相关使用
wib3.0 跨越,在跨越(ง •̀_•́)ง
数字经济破浪而来 ,LTD是权益独立的Web3.0网站?
随机推荐
Market development prospect and investment risk assessment report of China's humidity sensor industry from 2022 to 2028
[detailed explanation of Huawei machine test] check whether there is a digital combination that meets the conditions
Pytorch代码注意的细节,容易敲错的地方
LTE CSFB process
Sequoiadb Lake warehouse integrated distributed database, June 2022 issue
华为路由器忘记密码怎么恢复
First knowledge database
[JVM] [Chapter 17] [garbage collector]
High quality coding tool clion
Game push: image / table /cv/nlp, multi-threaded start!
PDK工藝庫安裝-CSMC
Remember an error in MySQL: the user specified as a definer ('mysql.infoschema '@' localhost ') does not exist
Construction of yolox based on paste framework
B站刘二大人-多元逻辑回归 Lecture 7
How to use PHP string query function
Easy to understand IIC protocol explanation
The digital economy has broken through the waves. Is Ltd a Web3.0 website with independent rights and interests?
Game push image / table /cv/nlp, multi-threaded start
A master in the field of software architecture -- Reading Notes of the beauty of Architecture
Redis message queue