C ++:const char * const的含义* [英] C++ : Meaning of const char*const*

查看:326
本文介绍了C ++:const char * const的含义*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在其中一个C ++程序中,我看到了一个函数原型: int Classifier :: command(int argc,const char * const * argv)

In one of the C++ programs, I saw a function prototype : int Classifier::command(int argc, const char*const* argv)

const char * const * argv 是什么意思?是否与 const char * argv [] 相同?
const char ** argv 也意味着相同?

What does const char*const* argv mean? Is it the same as const char* argv[]? Does const char** argv also mean the same?

推荐答案

不,它不同于 const char * argv [] const 禁止在特定的取消引用级别修改取消引用的值:

No, it's not the same as const char *argv[]. The const prohibits modifications of the dereferenced value at the particular level of dereferencing:

**argv = x; // not allowed because of the first const
*argv = y; // not allowed because of the second const
argv = z; // allowed because no const appears right next to the argv identifier

这篇关于C ++:const char * const的含义*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆