当前位置:网站首页>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 了
边栏推荐
- Yolov5 practice: teach object detection by hand
- Leetcode 1380. Lucky numbers in the matrix (save the minimum number of each row and the maximum number of each column)
- Is Alipay wallet convenient to use?
- Computer network interview assault
- Cloud computing - make learning easier
- Blue Bridge Cup real topic: the shortest circuit
- A wonderful time to buy and sell stocks
- R语言使用epiDisplay包的aggregate函数将数值变量基于因子变量拆分为不同的子集,计算每个子集的汇总统计信息
- How to learn automated testing?
- Classpath classpath
猜你喜欢
随机推荐
Check log4j problems using stain analysis
C operator overloads the query table
R语言ggplot2可视化:gganimate创建动态柱状图动画(gif)、在动画中沿给定维度逐步显示柱状图、enter_grow函数和enter_fade函数控制运动内插退出(渐变tweening)
期货账户的资金安全吗?怎么开户?
Growing up in the competition -- (Guangyou's most handsome cub) Pikachu walking
How to learn automated testing?
R语言使用dplyr包的transmute函数计算dataframe数据中的指定数据列的移动窗口均值、使用ggplot2包可视化移动均值与原始数据的折线图
Xia CaoJun ffmpeg 4.3 audio and video foundation to engineering application
2、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》启动并运行您的本地环境
Depth first search - DFS (burst search)
PTA year of birth
Implementation of converting PCM file to WAV
Domestic spot silver should be understood
主成分计算权重
Case study on comprehensive competitiveness of principal components
Distributed task queue: Celery usage record
Small exercise -- subnet division and summary
3、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》在本地铸造 NFT
Convert the robot's URDF file to mujoco model
Localization through custom services in the shuttle application









