当前位置:网站首页>[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;
边栏推荐
- Jushan database appears again in the gold fair to jointly build a new era of digital economy
- 养了只小猫咪
- B站刘二大人-线性回归 Pytorch
- Auto.js学习笔记17:基础监听事件和UI简单的点击事件操作
- Analysis of grammar elements in turtle Library
- Text classification still stays at Bert? The dual contrast learning framework is too strong
- A master in the field of software architecture -- Reading Notes of the beauty of Architecture
- P2802 回家
- [string] palindrome string of codeup
- H3C V7版本交换机配置IRF
猜你喜欢

Classes and objects (I) detailed explanation of this pointer

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

Station B Liu Erden linear regression pytoch

01. Project introduction of blog development project
[SQL Server fast track] - authentication and establishment and management of user accounts

Memory and stack related concepts

c语言——冒泡排序

LTE CSFB process

应用安全系列之三十七:日志注入
随机推荐
27io stream, byte output stream, OutputStream writes data to file
Embedded interview questions (I: process and thread)
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
Download, install and use NVM of node, and related use of node and NRM
入侵检测领域数据集总结
Redistemplate common collection instructions opsforvalue (II)
【经验】UltralSO制作启动盘时报错:磁盘/映像容量太小
continue和break的区别与用法
Installation de la Bibliothèque de processus PDK - csmc
Station B, Mr. Liu Er - multiple logistic regression, structure 7
华为BFD的配置规范
Jvxetable implant j-popup with slot
[detailed explanation of Huawei machine test] check whether there is a digital combination that meets the conditions
华为路由器忘记密码怎么恢复
Improve jpopup to realize dynamic control disable
Selective parameters in MATLAB functions
嵌入式面试题(四、常见算法)
[email protected] raspberry pie
类和对象(一)this指针详解
Deep learning -yolov5 introduction to actual combat click data set training