当前位置:网站首页>C language learning notes: type definition typedef and declaration external CSDN creation punch in
C language learning notes: type definition typedef and declaration external CSDN creation punch in
2022-07-01 18:39:00 【CFXLWT】
typedef: The type definition
To put it simply, simplify complex names , Go straight to the case :
tepedef struct data{
int a;
char b;
}p;// here p When used later, it is equivalent to struct data
int main {
p j;// use p To define variables of a data structure
j.a=1;// No problem.
j.b='b';// All are OK Of
// In this way, it is equivalent to putting a long struct data Simplified to p
// Similarly, it can be so :
tepedef int j;// It means that you can use j To define a int Variable
j i=12;// here j Equivalent to int
printf(“%d”,i);//12
typedef char* m;
m a;// In the same way
a="asd";
printf("%s",a);// Output asd
}extern: Statement
extern To declare a variable , The old rule goes directly to the case :
Like in one C There are two in the project C Source file main.c Main.c
among main.c:
int main{
printf("%d",p);/* Here you can see that there is no such variable in the source file , But we can declare in another source file , Then this output can also be established .*/
}Main.c:
extern int p=1;In this way main.c You can call p 了
边栏推荐
- Bug of QQ browser article comment: the commentator is wrong
- Operation of cmake under win
- ZABBIX alarm execute remote command
- GAMES202作业0-环境搭建过程&解决遇到的问题
- What if the reliability coefficient is low? How to calculate the reliability coefficient?
- 540. Single element in ordered array
- 主成分之综合竞争力案例分析
- [image denoising] matlab code for removing salt and pepper noise based on fast and effective multistage selective convolution filter
- Bernoulli distribution (a discrete distribution)
- C operator overloads the query table
猜你喜欢

Yuancosmos game farmersworld farmers world - core content of the second conference in China!

LeetCode-21合并两个有序链表
![[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush](/img/c0/25c1b96cc56fbd0231d32214d66718.jpg)
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush

NSI packaging script add file details

Highly reliable program storage and startup control system based on anti fuse FPGA and QSPI flash

Unity learning fourth week

PCL learning materials

How to find customers for investment attraction in industrial parks

3、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》在本地铸造 NFT

This is the latest opportunity of the London bank trend
随机推荐
LeetCode-21合并两个有序链表
What is web application security testing technology?
Slider verification code identification gadget display
On the language internationalization of Yongzhong Office
Extract the compressed package file and retrieve the password
Redis master-slave realizes 10 second check and recovery
Weekly recommended short videos: be alert to the confusion between "phenomena" and "problems"
Terms related to K line
力扣每日一题-第32天-589.N×树的前序遍历
540. Single element in ordered array / 1684 Count the number of consistent strings
The ultimate version of the 13th simulation of the single chip microcomputer provincial competition of the Blue Bridge Cup
[today in history] February 15: Pascal's father was born; YouTube was founded; Kotlin language comes out
Nearly 60% of the employees strongly support Ctrip's "3+2" working mode, and work at home for two days a week
NSI packaging script add file details
R语言使用epiDisplay包的followup.plot函数可视化多个ID(病例)监测指标的纵向随访图、使用n.of.lines参数指定显示的病例数
隐私沙盒终于要来了
Mujoco model learning record
[Chongqing Guangdong education] basic psychology reference materials of Tianjin Normal University
A wonderful time to buy and sell stocks
Opencv map reading test -- error resolution