【C语言】:
操作符(https://mp.csdn.net/editor/html/115218055)
数据类型(https://mp.csdn.net/editor/html/115219664)
自定义类型:结构体、枚举、联合(https://mp.csdn.net/editor/html/115373785)
变量、常量(https://mp.csdn.net/editor/html/115230188)
分支、循环语句(https://mp.csdn.net/editor/html/115234118)
字符串+转义字符+注释(https://mp.csdn.net/editor/html/115231391)
指针(https://mp.csdn.net/editor/html/115281303)
数组(https://mp.csdn.net/editor/html/115266750)
函数(https://mp.csdn.net/editor/html/115265396)
内容来自 B站 C语言教学视频 https://www.bilibili.com/video/BV1RX4y1u7Zh
指针
1. 指针是什么
指针是什么?
在计算机科学中,
指针
(
Pointer
)是编程语言中的一个对象,利用地址,它的值直接指向
(
points to
)存在电脑存储器中另一个地方的值。由于通过地址能找到所需的变量单元,可以
说,地址指向该变量单元。因此,将地址形象化的称为
“
指针
”
。意思是通过它能找到以它为地址
的
内存单元
。
指针是个变量,存放内存单元的地址(编号)。
#include <stdio.h>
int main()
{
int a = 10;//在内存中开辟一块空间
int *p = &a;//这里我们对变量a,取出它的地址,可以使用&操作符。
//将a的地址存放在p变量中,p就是一个之指针变量。
return 0;
}
总结:指针就是变量,用来存放地址的变量。(存放在指针中的值都被当成地址处理)。
指针是用来存放地址的,地址是唯一标示一块地址空间的。
指针的大小在
32
位平台是
4
个字节,在
64
位平台是
8
个字节