This commit is contained in:
许大仙 2024-08-11 10:22:58 +08:00
parent a7a7a84405
commit 98c377bcd4
5 changed files with 11 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 126 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 315 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 153 KiB

View File

@ -268,13 +268,9 @@ int main() {
} }
``` ```
* 其在内存中,就是这样的,如下所示:
![](./assets/5.png)
* 虽然,之前我们在程序中都是通过`变量名(普通变量)`直接操作内存中的存储单元;但是,编译器底层还是会通过`内存地址`来找到所需要的存储单元,如下所示: * 虽然,之前我们在程序中都是通过`变量名(普通变量)`直接操作内存中的存储单元;但是,编译器底层还是会通过`内存地址`来找到所需要的存储单元,如下所示:
![](./assets/6.svg) ![](./assets/5.svg)
> [!NOTE] > [!NOTE]
> >
@ -289,7 +285,7 @@ int main() {
* `普通变量`所对应的内存空间`存储`的是`普通的值`,如:整数、小数、字符等;`指针变量`所对应的内存空间`存储`的是另外一个变量的`地址(指针)`,如下所示: * `普通变量`所对应的内存空间`存储`的是`普通的值`,如:整数、小数、字符等;`指针变量`所对应的内存空间`存储`的是另外一个变量的`地址(指针)`,如下所示:
![](./assets/7.svg) ![](./assets/6.svg)
> [!NOTE] > [!NOTE]
> >
@ -300,6 +296,10 @@ int main() {
> >
> 下文中提及的`指针`都是`指针变量`,不再阐述!!! > 下文中提及的`指针`都是`指针变量`,不再阐述!!!
> [!WARNING]
>
> 如果你观察仔细的话,你可能会发现`指针变量`和`普通变量`在内存中占据的存储空间是不一样的,那么到底是什么原因造成这样的结果?
## 3.3 指针变量的定义 ## 3.3 指针变量的定义