当前位置:网站首页>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 了
边栏推荐
- Android development interview was badly hit in 3 years, and now the recruitment technical requirements are so high?
- On the language internationalization of Yongzhong Office
- 解决方案:可以ping别人,但是别人不能ping我
- LeetCode 148. Sort linked list
- 主成分之综合竞争力案例分析
- [source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
- 540. Single element in ordered array / 1684 Count the number of consistent strings
- Small exercise -- subnet division and summary
- Yuancosmos game farmersworld farmers world - core content of the second conference in China!
- 540. Single element in ordered array
猜你喜欢
Five degrees easy chain enterprise app is newly upgraded
Check log4j problems using stain analysis
[today in history] February 15: Pascal's father was born; YouTube was founded; Kotlin language comes out
How to find the optimal learning rate
12种数据量纲化处理方式
力扣每日一题-第32天-589.N×树的前序遍历
Depth first search - DFS (burst search)
每周推荐短视频:警惕“现象”与“问题”相互混淆
创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)
Lumiprobe 生物分子定量丨QuDye 蛋白定量试剂盒
随机推荐
Relationship between sensor size, pixel, dpi resolution, inch and millimeter
The method of real-time tracking the current price of London Silver
Thread forced join, thread forced join application scenarios
Yolov5 practice: teach object detection by hand
Sum of three numbers
研究了11种实时聊天软件,我发现都具备这些功能…
[acnoi2022] color ball
Find all missing numbers in the array
LeetCode-21合并两个有序链表
Redis master-slave realizes 10 second check and recovery
Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?
Financial judgment questions
Terms related to K line
Sanfeng cloud 0215 I often use
Talk about the favorite tools used by project managers
Using OpenSSL encryption to rebound shell traffic
JS how to convert a string with a delimiter into an n-dimensional array
[Chongqing Guangdong education] basic psychology reference materials of Tianjin Normal University
创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)
Set the style of QT property sheet control