当前位置:网站首页>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
边栏推荐
- d. TS --- for more detailed knowledge, please refer to the introduction on the official website (chapter of declaration document)
- Ehcache Memcache redis three caches
- The prefix of static of egg can be modified, including boots
- Camera imaging + homography transformation + camera calibration + stereo correction
- 2021-11-08
- Executable program execution process
- Differences between auto and decltype inference methods (learning notes)
- 世界与个人发展
- Three methods of list rendering
- Write the declaration of a function to return the reference of the array, and the array contains 10 string objects (notes)
猜你喜欢
Modèle axé sur le domaine DDD (III) - gestion des transactions à l'aide de Saga
npm升级后问题,慌得一批
what is wifi6?
Generation of straightening body in 3D slicer
what is wifi6?
分支与循环语句
Hongji | how does HR carry out self change and organizational change in the digital era?
Double click The jar package cannot run the solution
Camera imaging + homography transformation + camera calibration + stereo correction
領域驅動模型DDD(三)——使用Saga管理事務
随机推荐
Three methods of list rendering
FileReader API file operation
Arithmetic and logical operations
Why can't V-IF and V-for be used together
Create process memory management copy_ Mm - processes and threads (IX)
selenium預先加載cookie的必要性
弘玑微课堂 | Cyclone RPA之“灵活的数字员工”执行器
Use of uniapp native plug-ins
Getting started with varnish
phphphphphphphp
egg的static的前缀是可以修改惹,靴靴
X86 assembly syntax: at & T and Intel
Note: unordered_ Understanding and use of map
[untitled]
Three of three JS (WEB GL) model deletion / scene emptying / simple sorting of memory release
Requirements for SQL server to retrieve SQL and user information
巴普洛夫与兴趣爱好
Qwebsocket communication
Similarities and differences between vector and array (notes)
Data bus realizes the communication between brother components