From e290e51a4b5543b0fd6421e1a778b7d8e39d364e Mon Sep 17 00:00:00 2001 From: chensheng Date: Fri, 10 Apr 2020 20:04:25 +0800 Subject: [PATCH] delete basic_content/const/READ.md extern in line 46 and delete extern in line 64 --- basic_content/const/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/basic_content/const/README.md b/basic_content/const/README.md index f9c7f44..676c065 100644 --- a/basic_content/const/README.md +++ b/basic_content/const/README.md @@ -51,7 +51,7 @@ int ext * compile: g++ -o file file2.cpp file1.cpp * execute: ./file */ -extern int ext; +int ext; int main(){ std::cout<<(ext+10)< /** @@ -76,6 +76,7 @@ int main(){ ```

小结:可以发现未被const修饰的变量不需要extern显式声明!而const常量需要显式声明extern,并且需要做初始化!因为常量在定义后就不能被修改,所以定义时必须初始化。

+ ## 4.定义常量 ```c++