简体   繁体   English

使用new运算符初始化指向const float等的指针

[英]Initializing pointer to pointer to const float etc. using new operator

Consider the following declarations : 请考虑以下声明:

const float** b;
const float* const* c;
float* const* d;

First off all I want to make sure that : 首先,我要确保:

  • b is a pointer to pointer to const float . bpointer const float pointer

  • c is a pointer to const pointer to const float . cpointer const float const pointer

  • d is a pointer to a const pointer to float . d是一个pointer到一个const pointerfloat

Now my question is how can I initialize each pointer using new operator ? 现在我的问题是如何使用new operator初始化每个指针?

const float** b = new const float*();
const float* const* c = new const float*(nullptr);
float* const* d = new float*(nullptr);

the type with one less indirection and set values if they point on const 如果指向const,则只有少一个间接的类型和设置值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM