How many levels of pointers can we have?(我们可以有多少级指针?)
问题描述
单个变量中允许有多少个指针(*)?
How many pointers (*) are allowed in a single variable?
让我们考虑以下示例.
int a = 10;
int *p = &a;
同样我们可以有
int **q = &p;
int ***r = &q;
等等.
例如
int ****************zz;
推荐答案
C标准规定了下限:
276 实现应能够翻译和执行至少一个程序,该程序包含以下每一项限制的至少一个实例:[...]
5.2.4.1 Translation limits
276 The implementation shall be able to translate and execute at least one program that contains at least one instance of every one of the following limits: [...]
279 —12 个指针、数组和函数声明符(任意组合)修改声明中的算术、结构、联合或 void 类型
279 — 12 pointer, array, and function declarators (in any combinations) modifying an arithmetic, structure, union, or void type in a declaration
上限是特定于实现的.
这篇关于我们可以有多少级指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我们可以有多少级指针?
基础教程推荐
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
- c++ STL设置差异 2022-01-01
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- 随机插入/删除的综合向量与链表基准 2022-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
- C++:获取传递给函数的多维数组的行大小 2021-01-01
- 提升 ASIO 流缓冲 2021-01-01
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
