当前位置:网站首页>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
边栏推荐
- 创建进程内存管理copy_mm - 进程与线程(九)
- Why can't V-IF and V-for be used together
- open3d材质设置参数分析
- Cloud computing and cloud native architecture design of openshift
- The address value indicated by the pointer and the value of the object indicated by the pointer (learning notes)
- Uncle wolf is looking for a translator -- Plato -- ongoing translation
- Excel 2016 cannot open the file for the first time. Sometimes it is blank and sometimes it is very slow. You have to open it for the second time
- 双击.jar包无法运行解决方法
- Redis in node -- ioredis
- Source code analysis of how to use jump table in redis
猜你喜欢

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

(11) Vscode code formatting configuration

Camera imaging + homography transformation + camera calibration + stereo correction

STL learning notes 0x0001 (container classification)

Hongji cyclone RPA provides technical support for Guojin securities and realizes process automation in more than 200 business scenarios
Basic knowledge of redis

MFC implementation resources are implemented separately by DLL

Excel 2016 cannot open the file for the first time. Sometimes it is blank and sometimes it is very slow. You have to open it for the second time

selenium預先加載cookie的必要性

If I am PM's performance, movie VR ticket purchase display
随机推荐
Similarities and differences between vector and array (notes)
String class understanding - final is immutable
2021-10-08
修仙真实世界与游戏世界
Fast application fuzzy search
The address value indicated by the pointer and the value of the object indicated by the pointer (learning notes)
Knowledge of egg testing -- mock, Supertest, coffee
创建进程内存管理copy_mm - 进程与线程(九)
catkin_ What did package do
使用宝塔+xdebug+vscode远程调试代码
Self incrementing sequence creation of MySQL
Various situations of data / component binding
uni使用的一些坑
Branch and loop statements
领域驱动模型DDD(三)——使用Saga管理事务
Pavlov and hobbies
C test calls the paddlesharp module to recognize pictures and words
Watch depth monitoring mode
JS time format conversion
catkin_package到底干了什么