1.11M Members

convert from 'const char[ 9] to 'char *[]' error

 
0
 

char *default message[]="hghgghjgh"
char *message=defaultmessage
tis line showing error as
'initializing':cannot convert from 'const char[ 9] to 'char *[]'
can u help me....?

 
0
 

char *default message[]="hghgghjgh"
char *message=defaultmessage
tis line showing error as
'initializing':cannot convert from 'const char[ 9] to 'char *[]'
can u help me....?

Start your own thread for your problems

 
0
 

Well how you fix it depends on what you're trying to achieve in the first place (we can't tell from 2 lines and an error message).

This should work (but is it what you want?)

char  defaultmessage[]="hghgghjgh";
char *message=defaultmessage;
 
0
 

I think the actual error is caused by the fact that both *default message (or probably *defaultmessage )is declared as a pointer array and you can't assign (not 100% true, but here is ok) a string. This is why if you have without * it works.

or is there something else you are asking??

 
0
 

I think the actual error is caused by the fact that both *default message (or probably *defaultmessage )is declared as a pointer array
I guess you mean array of pointers

and you can't assign (not 100% true, but here is ok) a string.

Why is it ok here ?

This is why if you have without * it works. or is there something else you are asking??

I think the solution provided by Salem is correct

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article