Skip to content

Commit 8cd775b

Browse files
Update 勘误.md
1 parent e4189f3 commit 8cd775b

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

‎知识点总结/勘误.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,45 @@ const int* const p;//指向常量的常量指针。即p指向的内存和数
2424

2525
![](https://gitee.com/dongxingbo/Picture/raw/master//Wechat/Article/2021/%E5%9B%9B%E6%9C%88//20210501151749.png)
2626

27+
### 常量指针,指向常量的指针,指向常量的常量指针有什么区别?
28+
29+
原文
30+
31+
1. **常量指针**
32+
33+
```c
34+
int * const p
35+
```
36+
37+
先看const再看 * ,是p是一个常量类型的指针,不能修改这个指针的指向,但是这个指针所指向的地址上存储的值可以修改。
38+
39+
2. **指向常量的指针**
40+
41+
```c
42+
const int *p
43+
```
44+
45+
先看 * 再看const,定义一个指针指向一个常量,不能通过指针来修改这个指针指向的值
46+
47+
改为
48+
49+
1. **指针常量**
50+
51+
```c
52+
int * const p
53+
```
54+
55+
先看const再看 * ,p是一个常量类型的指针,**不能修改这个指针的指向**,但是这个指针所指向的地址上存储的**值可以修改**
56+
57+
2. **常量指针**
58+
59+
```c
60+
const int *p
61+
int const *p
62+
```
63+
64+
先看*再看const,定义一个指针指向一个常量,不能通过指针来修改这个指针**指向的值**
65+
2766

2867

2968
## ARM体系与架构

0 commit comments

Comments
 (0)