当前位置:网站首页>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 了
边栏推荐
- Redis master-slave realizes 10 second check and recovery
- Search 2D matrix 2
- LeetCode 148. Sort linked list
- Terms related to K line
- 1、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》什么是NFT
- Sum of three numbers
- 2、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》启动并运行您的本地环境
- Step size of ode45 and reltol abstol
- Cloud picture says | distributed transaction management DTM: the little helper behind "buy buy buy"
- R语言使用epiDisplay包的followup.plot函数可视化多个ID(病例)监测指标的纵向随访图、使用n.of.lines参数指定显示的病例数
猜你喜欢

540. Single element in ordered array

为什么独立站卖家都开始做社交媒体营销?原来客户转化率能提高这么多!

What impact will multinational encryption regulation bring to the market in 2022

Fix the black screen caused by iPhone system failure

Lumiprobe 生物分子定量丨QuDye 蛋白定量试剂盒

NSI packaging script add file details

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

. Net cloud native architect training camp (permission system code implements actionaccess) -- learning notes

每周推薦短視頻:警惕“現象”與“問題”相互混淆

Yolov5 practice: teach object detection by hand
随机推荐
How to learn automated testing?
PTA year of birth
Calculation of intersection of two line segments
每周推荐短视频:警惕“现象”与“问题”相互混淆
Financial judgment questions
Leetcode problem solving series -- continuous positive sequence with sum as s (sliding window)
Weekly recommended short videos: be alert to the confusion between "phenomena" and "problems"
Happy new year | 202112 monthly summary
What impact will multinational encryption regulation bring to the market in 2022
Detailed explanation of ArrayList expansion
Operation of cmake under win
Apk signature process introduction [easy to understand]
Introduction to easyclick database
How to change guns for 2D characters
Growing up in the competition -- (Guangyou's most handsome cub) Pikachu walking
Extract the compressed package file and retrieve the password
Slider verification code identification gadget display
2、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》启动并运行您的本地环境
Yuancosmos game farmersworld farmers world - core content of the second conference in China!
Redis master-slave realizes 10 second check and recovery