delete basic_content/const/READ.md extern in line 46 and delete extern in line 64

This commit is contained in:
chensheng 2020-04-10 20:04:25 +08:00
parent ada2b0c80f
commit e290e51a4b

View File

@ -51,7 +51,7 @@ int ext
* compile: g++ -o file file2.cpp file1.cpp * compile: g++ -o file file2.cpp file1.cpp
* execute: ./file * execute: ./file
*/ */
extern int ext; int ext;
int main(){ int main(){
std::cout<<(ext+10)<<std::endl; std::cout<<(ext+10)<<std::endl;
} }
@ -61,7 +61,7 @@ int main(){
```c++ ```c++
//extern_file1.cpp //extern_file1.cpp
extern const int ext=12; const int ext=12;
//extern_file2.cpp //extern_file2.cpp
#include<iostream> #include<iostream>
/** /**
@ -76,6 +76,7 @@ int main(){
``` ```
<p><font style="color:red">小结可以发现未被const修饰的变量不需要extern显式声明而const常量需要显式声明extern并且需要做初始化因为常量在定义后就不能被修改所以定义时必须初始化。</font></p> <p><font style="color:red">小结可以发现未被const修饰的变量不需要extern显式声明而const常量需要显式声明extern并且需要做初始化因为常量在定义后就不能被修改所以定义时必须初始化。</font></p>
## 4.定义常量 ## 4.定义常量
```c++ ```c++