惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
腾讯CDC
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
V
V2EX
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
量子位
F
Fortinet All Blogs
G
Google Developers Blog
T
The Blog of Author Tim Ferriss
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
J
Java Code Geeks
S
SegmentFault 最新的问题
D
Docker
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
M
MIT News - Artificial intelligence
博客园 - 【当耐特】

时间的朋友

Windows 命令行密码重置 Anaconda安装 typescript 注解解读1 Konvajs Shape加载自定义图片 sshpass 使用 why-is-node-running webgl笔记 SharedArrayBuffer is not defined blender 常用快捷键 | 时间的朋友 vue -- v3.4commit提交记录2 vue2 升级vue3报错问题整理 着色器 expressjs 源码 hyper-V arch linux 网络配置 element input数字格式化 three 拼接货架 WebAudio笔记 Windows nginx重启bat脚本 vue -- v3.4commit提交记录 URI malformed vue3 -- Class 对象在组件中使用范例 | 时间的朋友 ruby 安装和升级 element-plus 老版本cascader使用卡死问题 vue3 内置Transition组件 | 时间的朋友 前端memo的实现 | 时间的朋友 Vue -- vue-class-component源码 | 时间的朋友 linux 优化脚本 typescript 装饰器 | 时间的朋友 microbundle 源码 | 时间的朋友 WSL2问题解决WslRegisterDistribution failed with error: 0x800701bc
c++笔记 | 时间的朋友
2022-07-30 · via 时间的朋友

Published: · LastMod: July 31, 2022 · 272 words

using和namespace都是C++中的关键字。std是标准库所驻之命名空间(namespace)的名称。

指针 🔗

*: 定义指针变量

&:取值对象内存地址

1
2
3
4
5
6
7
int size = 18;

int *p = &size;


0x7ffee30a3f28------
18

如果要访问一个由指针所指的对象,我们必须对该指针进行提领(dereference)操作——也就是取得“位于该指针所指内存地址上”的对象.

在指针之前使用*号,便可以达到这个目的

1
2
3
4
5
6
7
8
    cout << p
    << "\n------\n"
    << *p;

# ...
0x7ffeec767f28
------
18

指针可能并不指向任何对象。

  • 一个未指向任何对象的指针,其地址值为0。有时候我们称之为null指针。

  • 任何指针都可以被初始化,或是令其值为0。