当前位置:网站首页>Reading notes of modern methods of C language programming
Reading notes of modern methods of C language programming
2022-04-23 05:30:00 【Mikawa】
The first 2 Chapter C Basic concepts of language
Compile and link
- Preprocessing
- compile
- link
The first 4 Chapter expression
The left value
- Occupy a certain location in computer memory
- It can be placed to the left of the assignment expression
Self increase and self decrease
++i Than i++ The operation is better
The first 7 Chapter Basic types
sizeof Operator
- Gets the number of bytes of the data type
- sizeof Can find the length of the static memory allocation array
- sizeof Can't find the size of dynamically allocated memory
The first 8 Chapter Array
The array subscript
The array subscript is the address offset relative to the first address of the array , Avoid accessing out of bounds when using subscripts to access array elements .
Array initialization
- During array initialization, only the first element can be assigned to 0, The remaining elements in the array are initialized to 0.
- You can define an array without specifying the array size , Determine the size of the array by initializing the number of elements .
The first 12 Chapter Pointers and arrays
Pointers are used for array processing
- Pointers have a way of accessing array elements similar to array names , Use [] Operator to get the array element of the offset relative to the address saved by the pointer .
- You can move the pointer to the end of the array by adding a positive integer to the pointer
The first 14 Chapter The preprocessor
Macro definition
- Instead of global variables
- Eliminate magic number
- It is convenient for program modification , Where the same value is used , Just modify the macro definition
- Macro definitions with parameters use () and do {…} while(0) Protect execution statements
- # Operator can be used to convert the character after the operator into a string ,## Operator can connect the identifiers before and after the operator into an identifier
Conditional compilation
- Debug code blocks using conditional compilation switches , Control the output of debugging information
- Use conditional compilation to protect header files , Avoid multiple inclusion of the same header file
The first 17 Chapter Advanced application of pointer
Assign arrays dynamically
Use malloc Function to allocate dynamic storage space , Need to cooperate with sizeof Operator to calculate the number of bytes of the element of the specified type , And allocate the space of integer multiples .
Free up storage space
- Use free() Function to free dynamically allocated storage space
- The pointer after releasing space needs to be set to NULL, Avoid wild pointers
The first 18 Chapter Statement
static Storage type
- static Declared variables are stored in the static area , Its value is valid throughout the life of the program , It will not be destroyed because of the return of function execution, just like local variables .
- Use static Declarations can make variables and functions visible only in this document , Realization “ encapsulation ” The effect of
版权声明
本文为[Mikawa]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220543094087.html
边栏推荐
- qt. qpa. plugin: Could not find the Qt platform plugin “xcb“ in ““
- Edit, cancel, pull up menu
- 領域驅動模型DDD(三)——使用Saga管理事務
- Note: unordered_ Understanding and use of map
- After NPM was upgraded, there was a lot of panic
- 如果我是pm之 演出电影vr购票展示
- Click the Add button - a box appears (similar to adding learning experience - undergraduate - Graduate)
- On the use of constant pointer and pointer constant -- exercise (record)
- 五一劳动节期间什么理财产品会有收益?
- Use pagoda + Xdebug + vscode to debug code remotely
猜你喜欢

QSS, qdateedit, qcalendarwidget custom settings
![Laravel [view]](/img/39/71db98d8832d9419bcc1097594d1b6.png)
Laravel [view]
Redis的基本知识

如果我是pm之 演出电影vr购票展示

Three of three JS (webgl) is simple to draw lines / arcs according to points (based on linegeometry / line2 / linematerial, draw two arc segments based on the center of the circle)

Branch and loop statements

QT displays the specified position and size of the picture

phphphphphphphp

SQL Server检索SQL和用户信息的需求

Quick app bottom navigation bar
随机推荐
Some pits used by uni
After adding qmenu to qtoolbutton and QPushButton, remove the triangle icon in the lower right corner
领域驱动模型DDD(三)——使用Saga管理事务
Tslint annotations ignore errors and restful understanding
egg的static的前缀是可以修改惹,靴靴
Self incrementing sequence creation of MySQL
Call the interface to get the time
CPT 104_ TTL 09
Multi process model in egg -- egg document Porter
open3d材质设置参数分析
IPI interrupt
[untitled] Notepad content writing area
Write the declaration of a function to return the reference of the array, and the array contains 10 string objects (notes)
Understand the relationship between promise async await
2021-11-08
Uncle wolf is looking for a translator -- Plato -- ongoing translation
The title bar will be pushed to coincide with the status bar
d. TS --- for more detailed knowledge, please refer to the introduction on the official website (chapter of declaration document)
[no title] Click the classification jump page to display the details
Hongji cyclone RPA provides technical support for Guojin securities and realizes process automation in more than 200 business scenarios