当前位置:网站首页>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 了
边栏推荐
- About enterprise middle office planning and it architecture microservice transformation
- Classpath classpath
- 力扣每日一题-第32天-1232. 缀点成线
- [Chongqing Guangdong education] basic psychology reference materials of Tianjin Normal University
- Leetcode203 移除链表元素
- Set the style of QT property sheet control
- R语言ggplot2可视化:gganimate创建动态柱状图动画(gif)、在动画中沿给定维度逐步显示柱状图、enter_grow函数和enter_fade函数控制运动内插退出(渐变tweening)
- Yuancosmos game farmersworld farmers world - core content of the second conference in China!
- Distributed task queue: Celery usage record
- Leetcode-160相交链表
猜你喜欢

LeetCode 148. Sort linked list

t10_ Adapting to Market Participantsand Conditions

Leetcode-128 最长连续序列

Nearly 60% of the employees strongly support Ctrip's "3+2" working mode, and work at home for two days a week

Record 3 - the state machine realizes key control and measures the number of external pulses

Localization through custom services in the shuttle application

Flex layout

C# SelfHost WebAPI (2)

Three.js学习-相机Camera的基本操作(了解向)

How to find customers for investment attraction in industrial parks
随机推荐
Opencv map reading test -- error resolution
Data query language (DQL)
Apk signature process introduction [easy to understand]
Operating system interview assault
Mujoco's biped robot Darwin model
Highly reliable program storage and startup control system based on anti fuse FPGA and QSPI flash
Yolov5 practice: teach object detection by hand
PMP daily three questions (February 15, 2022)
LeetCode-21合并两个有序链表
Financial judgment questions
[noip2015] jumping stone
MySQL connection tools
A wonderful time to buy and sell stocks
Roll out! Enlightenment!
Relational database management system of easyclick
Introduction to easyclick database
为什么独立站卖家都开始做社交媒体营销?原来客户转化率能提高这么多!
Session layer of csframework, server and client (1)
D. Yet Another Minimization Problem
Five degrees easy chain enterprise app is newly upgraded