I tried to initialized const char pointer to pointer variable. Following is the way i did it.but once i run the program it thows an error(Pops up "encountered an problem and needs to close... Tell microsoft about this problem...")

const char * FB="test";
const char **Feedback ;
Feedback = &FB;

How can I intialize a value for const char pointer to pointer variable

Recommended Answers

All 5 Replies

Are you saying that just those 3 lines (and nothing else) cause a problem?

Or do you then go on to do something with Feedback which actually causes the crash?
A small complete program which crashes is much more useful for us to tell you where you went wrong.

It should be
char * const * Feedback = &FB;

Hi salem,

as u said problem might not in those three lines. becoz i m passing that FeedBack value to a function

MyClass obj;
obj.setvalue(FeeedBack); // here Feed Back is of type const char** FeedBack.

try this: obj.setvalue( &FB );

Hi all,

Its working fine if I pass it as a char ** FeedBack not as Const char ** Feedback.
seems to b we cant pass const values like this way???

Like I said, if you don't post exactly what you're trying to do (like how you implement the function you're calling, and why the use of const is important).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.