Click here to Skip to main content
15,560,126 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sir i created the pointer array:

char *p[10];
p[1]="hai";
p[2]="how";


i want to covert to the char*;

i use typecasting

char *a = (char*)p;


Is it correct..

how can i decast that . and how to get the data back..
Posted

1 solution

char *p[10];
char *a = (char*)p;
Is not right (that's why you needed to add the cast)

char* p[10] creates an array of ten character pointers, char *a creates a character pointer.
In order to load the value of p into a, it needs to be a char**:
char *p[10];
char **a = p;
 
Share this answer
 
Comments
PrafullaVedante 30-Jul-11 5:32am    
Perfect. My 5 :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900