mirror of
https://github.com/huihut/interview.git
synced 2025-12-18 13:04:38 +03:00
This commit is contained in:
11
README_en.md
11
README_en.md
@@ -127,6 +127,17 @@ const int* function6(); // returns a pointer variable to a constant, use: co
|
|||||||
int* const function7(); // returns a constant pointer to a variable, use: int * const p = function7 ();
|
int* const function7(); // returns a constant pointer to a variable, use: int * const p = function7 ();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### #define and const constants
|
||||||
|
|
||||||
|
#define|const constants
|
||||||
|
---|---
|
||||||
|
Macro definitions, equivalent to character substitution|constant declarations
|
||||||
|
preprocessor processing|compiler processing
|
||||||
|
without type safety checking|with type safety checking
|
||||||
|
no memory allocation|memory allocation required
|
||||||
|
stored in code segment|stored in data segment
|
||||||
|
Can be canceled by `#undef`|Not cancelable
|
||||||
|
|
||||||
### static
|
### static
|
||||||
|
|
||||||
#### Function
|
#### Function
|
||||||
|
|||||||
@@ -115,6 +115,17 @@ const int* function6(); // 返回一个指向常量的指针变量,使用
|
|||||||
int* const function7(); // 返回一个指向变量的常指针,使用:int* const p = function7();
|
int* const function7(); // 返回一个指向变量的常指针,使用:int* const p = function7();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 宏定义 #define 和 const 常量
|
||||||
|
|
||||||
|
宏定义 #define|const 常量
|
||||||
|
---|---
|
||||||
|
宏定义,相当于字符替换|常量声明
|
||||||
|
预处理器处理|编译器处理
|
||||||
|
无类型安全检查|有类型安全检查
|
||||||
|
不分配内存|要分配内存
|
||||||
|
存储在代码段|存储在数据段
|
||||||
|
可通过 `#undef` 取消|不可取消
|
||||||
|
|
||||||
### static
|
### static
|
||||||
|
|
||||||
#### 作用
|
#### 作用
|
||||||
|
|||||||
11
docs/en.md
11
docs/en.md
@@ -120,6 +120,17 @@ const int* function6(); // returns a pointer variable to a constant, use: co
|
|||||||
int* const function7(); // returns a constant pointer to a variable, use: int * const p = function7 ();
|
int* const function7(); // returns a constant pointer to a variable, use: int * const p = function7 ();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### #define and const constants
|
||||||
|
|
||||||
|
#define|const constants
|
||||||
|
---|---
|
||||||
|
Macro definitions, equivalent to character substitution|constant declarations
|
||||||
|
preprocessor processing|compiler processing
|
||||||
|
without type safety checking|with type safety checking
|
||||||
|
no memory allocation|memory allocation required
|
||||||
|
stored in code segment|stored in data segment
|
||||||
|
Can be canceled by `#undef`|Not cancelable
|
||||||
|
|
||||||
### static
|
### static
|
||||||
|
|
||||||
#### Function
|
#### Function
|
||||||
|
|||||||
Reference in New Issue
Block a user