数组的地址是否等于C

数组的地址是否等于C

本文介绍了数组的地址是否等于C ++中其第一个元素的地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于WG14/N1570中的以下句子,因此可以用C保证这一点:

This can be guaranteed in C because of the following sentence in WG14/N1570:

但是在WG21/N4527中,即在C ++中,相应的句子变为

But in WG21/N4527, i.e. in C++, the corresponding sentence becomes

而单词"describes"更改为"contains",则不能保证数组的地址等于其第一个元素的地址.此更改是有意还是无意?如果是故意的,数组的地址是否等于C ++中数组的第一个元素的地址?如果可以,那么C ++标准中的哪一段可以保证这一点?

while the word "describes" is changed to "contains", which cannot guarantee that the address of the array equals to that of its first element. Is this change intentional or unintentional? If it is intentional, does the address of the array equal to that of its first element in C++? If it does, which paragraph in the C++ standard can guarantee this?

推荐答案

我认为它在任何地方都没有明确说明,但我相信它来自5.3.3 Sizeof:

I don't think it's stated explicitly anywhere, but I believe it follows from 5.3.3 Sizeof:

唯一可以存储在数组起始地址的是数组的第一个元素.

that the only thing that can be stored at the array's starting address is the array's first element.

这篇关于数组的地址是否等于C ++中其第一个元素的地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 10:26