const char*to const char**

use*_*590 -3 c++ pointers type-conversion char

Is there a easy way to convert a const char* to a const char** in C++ (without the use of Boost)? I've tried to use &myConstCharP but that didn't work.

Bal*_*ick 5

我在这里看不到问题.以下代码对我来说很好:

int main(int argc, char **argv)
{
    char c = 'a';
    const char *myConstCharP = &c;
    const char **p = &myConstCharP;

    printf("Your original char is: %c",**p);
}
Run Code Online (Sandbox Code Playgroud)

  • `const char***ptr_p =&p;``const char****ptr_ptr_p =&ptr_p;`甚至更多! (2认同)