gpt4 book ai didi

c++ - const int* const fun(const int* const& p) const; 的含义

转载 作者:搜寻专家 更新时间:2023-10-31 00:12:28 29 4
gpt4 key购买 nike

const int* const fun(const int* const& p) const;

我试图弄清楚这个给定函数原型(prototype)的输入参数。我在这两个之间争论,不确定哪个是正确的。

  1. 输入是一个 const 引用,它指的是一个 const int 指针。因此引用是常量,指针也是常量,但它指向的值是可以改变的。
  2. 输入是对指向常量整数的 const int 指针的 const 引用。

最佳答案

您拥有的是对指向常量整数的常量指针的引用。

关于c++ - const int* const fun(const int* const& p) const; 的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30080720/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com