diff --git a/README_en.md b/README_en.md index 9ff2de5..ef6a2e6 100644 --- a/README_en.md +++ b/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 (); ``` +#### #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 #### Function diff --git a/docs/README.md b/docs/README.md index 3e3a384..8f000ce 100644 --- a/docs/README.md +++ b/docs/README.md @@ -115,6 +115,17 @@ const int* function6(); // 返回一个指向常量的指针变量,使用 int* const function7(); // 返回一个指向变量的常指针,使用:int* const p = function7(); ``` +#### 宏定义 #define 和 const 常量 + +宏定义 #define|const 常量 +---|--- +宏定义,相当于字符替换|常量声明 +预处理器处理|编译器处理 +无类型安全检查|有类型安全检查 +不分配内存|要分配内存 +存储在代码段|存储在数据段 +可通过 `#undef` 取消|不可取消 + ### static #### 作用 diff --git a/docs/en.md b/docs/en.md index 68336b3..91dac88 100644 --- a/docs/en.md +++ b/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 (); ``` +#### #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 #### Function