当前位置:网站首页>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 了
边栏推荐
- Leetcode-83 删除排序链表中重复的元素
- Definition of rotation axis in mujoco
- 隐私沙盒终于要来了
- Operation of cmake under win
- Record 3 - the state machine realizes key control and measures the number of external pulses
- R语言使用dplyr包的transmute函数计算dataframe数据中的指定数据列的移动窗口均值、使用ggplot2包可视化移动均值与原始数据的折线图
- Relational database management system of easyclick
- R语言ggplot2可视化:gganimate包transition_time函数创建动态散点图动画(gif)、shadow_wake函数配置动画的渐变效果(gradual falloff)拖尾效应
- Lumiprobe非荧光炔烃丨EU(5-乙炔基尿苷)
- Search 2D matrix 2
猜你喜欢

Leetcode-141环形链表
![[source code analysis] NVIDIA hugectr, GPU version parameter server - (1)](/img/92/f3a70e7086aeedf41eea3eef98b5aa.jpg)
[source code analysis] NVIDIA hugectr, GPU version parameter server - (1)

隐私沙盒终于要来了

The 13th simulation problem of the single chip microcomputer provincial competition of the Blue Bridge Cup

Set the style of QT property sheet control

12 data dimensioning processing methods

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

C# SelfHost WebAPI (2)

Using OpenSSL encryption to rebound shell traffic

每周推薦短視頻:警惕“現象”與“問題”相互混淆
随机推荐
1、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》什么是NFT
Mysql database design
540. Single element in ordered array
因子分析怎么计算权重?
How to learn automated testing?
. Net cloud native architect training camp (permission system code implements actionaccess) -- learning notes
Subnet division and summary
Thread forced join, thread forced join application scenarios
Fix the black screen caused by iPhone system failure
[source code analysis] NVIDIA hugectr, GPU version parameter server - (1)
每周推薦短視頻:警惕“現象”與“問題”相互混淆
R语言使用epiDisplay包的aggregate函数将数值变量基于因子变量拆分为不同的子集,计算每个子集的汇总统计信息
Using OpenSSL encryption to rebound shell traffic
Basic usage of shell script
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
R语言使用epiDisplay包的tableStack函数制作统计汇总表格(基于目标变量分组的描述性统计、假设检验等)、不设置by参数则计算数据框指定数据列范围的基础描述性统计信息
Android development interview was badly hit in 3 years, and now the recruitment technical requirements are so high?
Leetcode-160相交链表
12种数据量纲化处理方式
Slider verification code identification gadget display