当前位置:网站首页>[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
- JS array list actual use summary
- 【华为机试真题详解】统计射击比赛成绩
- [email protected] raspberry pie
- CoDeSys note 2: set coil and reset coil
- SequoiaDB湖仓一体分布式数据库2022.6月刊
- Memory and stack related concepts
- continue和break的区别与用法
- 29io stream, byte output stream continue write line feed
- B站刘二大人-多元逻辑回归 Lecture 7
猜你喜欢

05. Security of blog project

What is independent IP and how about independent IP host?

ArcGIS应用基础4 专题图的制作

ARTS Week 25

Promise summary

Li Chuang EDA learning notes 12: common PCB board layout constraint principles

H3C V7版本交换机配置IRF

H3C防火墙RBM+VRRP 组网配置

Station B Liu Erden - linear regression and gradient descent

网站进行服务器迁移前应做好哪些准备?
随机推荐
[JVM] [Chapter 17] [garbage collector]
Demander le Code de texte standard correspondant à un centre de travail dans l'ordre de production
类和对象(一)this指针详解
LeetCode_ String inversion_ Simple_ 557. Reverse word III in string
PDK工藝庫安裝-CSMC
【华为机试真题详解】检查是否存在满足条件的数字组合
Auto. JS learning notes 17: basic listening events and UI simple click event operations
入侵检测领域数据集总结
01. Project introduction of blog development project
Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
Web Security (V) what is a session? Why do I need a session?
Auto.js学习笔记17:基础监听事件和UI简单的点击事件操作
Some easy-to-use tools make your essay style more elegant
28io stream, byte output stream writes multiple bytes
数字经济破浪而来 ,LTD是权益独立的Web3.0网站?
Memory and stack related concepts
Deep learning -yolov5 introduction to actual combat click data set training
The digital economy has broken through the waves. Is Ltd a Web3.0 website with independent rights and interests?
局域网同一个网段通信过程
初识数据库