当前位置:网站首页>How to describe variables: storage class, life cycle, scope, link attribute
How to describe variables: storage class, life cycle, scope, link attribute
2022-07-18 21:27:00 【Sky paste soil】
According to the storage class of a variable 、 Scope 、 Link properties 、 Life cycle to describe the variable .
among , Storage classes determine the lifecycle , The scope determines the link properties .
Storage class
Storage classes indicate where variables are stored . See Bowen Linux Next C Memory layout of language programs _ Tiantutu's blog -CSDN Blog
Scope
Scope indicates the scope of the variable . Include :
(1) Code block scope , That is, a piece of code within curly brackets .
(2) Function prototype scope .
(3) File scope , That is, variables defined outside all functions , It is visible from its definition to the end of the file , Also called global variables .
Link properties
Link properties , It refers to whether variables are shared among multiple files .
Link properties , Include empty links 、 External links 、 internal link .
Empty connection means that only the function prototype or code block where the variable is located is allowed to use .
Variables in the file scope may have external links or internal links , Variables with external links can be used anywhere in a multi file program ( use extern modification ), Variables with internal links can be used anywhere in a file ( use static modification ).
Life cycle
The life cycle indicates when to allocate and reclaim memory for variables .
The lifecycle includes static storage periods 、 Automatic storage period :
Static storage period , Indicates that this variable has been present during program execution .
Automatic storage period , When the program enters the code block that defines these variables , Will allocate memory for these variables , When exiting this code block , The allocated memory will be freed ;
边栏推荐
- putchar()
- True question of CCF (anger takes 100 faints)
- 裁员之水天上来
- 实战项目:数据访问层时所遇问题
- What is the event delegation in JS?
- Unity-2D像素晶格化消融
- 剑指 Offer 55 - II. 平衡二叉树
- Topic 2-iis write permission vulnerability analysis and traceability
- Win10 how to convert FAT32 format disks into NFTs format without formatting
- Learning notes of Transe model
猜你喜欢

Sword finger offer 53 - ii Missing numbers from 0 to n-1

Leetcode+ 86 - 90 double pointer, backtracking, interval DP topics

剑指 Offer 54. 二叉搜索树的第k大节点

Sql笔记

Redis - detailed explanation of slot management commands

Sword finger offer 57 And are two numbers of S

Learning notes of Transe model

Paddle crowdnet population density estimation

Sword finger offer 54 The k-th node of binary search tree

如何应对供应链中第三方的安全风险
随机推荐
R language uses LM function to build multiple regression model, writes regression equation according to model coefficient, and uses summary function to calculate the summary statistical information of
[my advanced journey of OpenGL learning] find in NDK development_ Where is the system dynamic library found in library?
科技云报道:构建可观测性的核心能力是什么?
I2C communication protocol realizes data display on OLED display screen
The concept and properties of | double integral under high numbers | high numbers | handwritten notes
劍指 Offer 57. 和為s的兩個數字
题目2-IIS写权限漏洞分析溯源
World Tour Finals 2019 D - Distinct Boxes 题解
Gd32f4 (6): serial port garbled caused by crystal oscillator
Unity - Common APIs (continued time class)
VMware 恢复快照出现 无法创建 5040 MB 的匿名分页文件: 系统资源不足,无法完成请求的服务
Classic application method of installing HAP on Hongmeng development board
CANN体验官第五期体验纪实(上)
华为云在线课堂AI技术领域课程“深度学习”学习心得体会---第二周
Sword finger offer 55 - I. depth of binary tree
(manual) [sqli-labs54-57] limit the number of injections: joint injection, error echo, get injection
Introduction to sap appgyver
推荐一篇写得很好的“I2C协议讲解”文章
C language as a push box
剑指 Offer 53 - I. 在排序数组中查找数字 I