当前位置:网站首页>In depth analysis of C language - variable error prone knowledge points # dry goods inventory #
In depth analysis of C language - variable error prone knowledge points # dry goods inventory #
2022-07-02 03:22:00 【Konjak_ Konnyaku】
Variables are very basic content , But be sure to master !
3.1. What is a variable
3.2. How to define variables - How to use it?
3.3 Why define variables
Computers are born to solve the problem of people's lack of computing power . namely , Computers are for calculation .
And calculation , You need data .
And to calculate , Any moment , Not all data should be calculated immediately .Why variables are needed ? Because there is data that needs to be saved temporarily , Waiting for further processing
3.4 The essence of variable definition
- The program runs , It needs to be loaded into memory
- Program calculation , You need to use variables
The essence of variable definition : Open up a space in memory , To hold data ( Why must it be memory : Because defining variables , It's also part of program logic , The program has been loaded into memory )
3.5 The nature of variable declarations
Declared variables are usually added extern keyword :
Be careful : Cannot initialize when declaring
The declaration even tells the compiler , This variable is defined elsewhere , Declarations do not allocate memory space to variables !!
3.6 About the difference between declaration and definition
difference : The definition has memory allocation , Declaration has no memory allocation
Be careful : Cannot initialize when declaring
Statement
The declaration just tells the compiler that there is such a variable or function , This function or variable is defined in other places , So in this process, no memory is allocated again , Therefore, a declaration can be declared more than once ;
Definition
A program opens up memory space for its variables or functions at run time , Definition can only be defined once .
As for initialization , Is to complete the development of memory space , Fill in the specified value for the memory opened up .
边栏推荐
猜你喜欢
随机推荐
Force deduction daily question 540 A single element in an ordered array
Framing in data transmission
Intersection of Venn graph
JDBC details
Global and Chinese markets for welding equipment and consumables 2022-2028: Research Report on technology, participants, trends, market size and share
【JVM】创建对象的流程详解
寻找重复数[抽象二分/快慢指针/二进制枚举]
Go执行shell命令
Verilog 时序控制
Cache processing scheme in high concurrency scenario
verilog REG 寄存器、向量、整数、实数、时间寄存器
Verilog 避免 Latch
KL divergence is a valuable article
Verilog wire type
PHP array processing
What is hybrid web containers for SAP ui5
C # joint Halcon's experience of breaking away from Halcon environment and various error reporting solutions
Qualcomm platform wifi-- WPA_ supplicant issue
Aaaaaaaaaaaa
Generate random numbers that obey normal distribution








