Skip to content

Commit

Permalink
Update C++变量学习
Browse files Browse the repository at this point in the history
  • Loading branch information
WQBin committed Mar 8, 2019
1 parent 51cc6de commit 23333c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions _posts/2019-03-08-C++变量学习.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: C++变量学习
layout: post
categories: 编程语言
tags: 'C++,变量,C++ primer'
tags: C++ 变量 C++primer
---
<span id="jump"></span>

Expand All @@ -21,13 +21,13 @@ tags: 'C++,变量,C++ primer'
--------------------------------
<br/>
### 为了允许把程序拆分成多个逻辑部分来编写,C++语言支持分离式编译机制,该机制允许将程序分隔为若干个文件,每个文件可被独立编译。为了支持分离式编译,C++语言将声明和定义区别开来
#



- `声明`使得名字为变量所知
- `定义`负责创建与名字关联的实体
<br/>
#

``` c++
extern int i; //声明i,不是定义
int j;//声明并定义j
Expand All @@ -39,7 +39,7 @@ extern double pi=3.1416;//定义
------------------------------------
<br/>

#

>`C++标识符`由字母、数字和下划线组成,其中必须以字母或者下划线开头,标识符的长度没有限制,但是对大小写字母敏感。
以下为变量命名规范:
Expand All @@ -58,7 +58,7 @@ extern double pi=3.1416;//定义
>作用域是程序的一部分,在其中名字有其特定的含义。C++语言中,大多数作用域都以花括号为分隔。

#

同一个名字在不同的作用域中可能指向不同的实体,名字的有效区域始于名字的声明语句,以声明语句所在的作用域末端为结束。
<br/>
### **嵌套的作用域**
Expand All @@ -68,7 +68,7 @@ extern double pi=3.1416;//定义
<br/>
<br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
##<center>[回到顶部](#jump)
##<center>[回到顶部](#jump)<center/>
<br/>

>#*<center>The End*

0 comments on commit 23333c6

Please sign in to comment.