can anyone explain this.......!!!!!!!!!!

indian.21987's Avatar
Light Poster
Difference between
const char*ptr and
char *const ptr
please give detailed explaination with examples
DaWei's Avatar, Join Date: Dec 2006
Team Leader
The first one says that ptr is a pointer to a const char, but that the pointer can be modified.

The second says that the ptr is const, but the char is modifiable.

If that isn't detailed enough, or exemplar enough, let me recommend your documentation, or Google.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
const char* ptr means "ptr points to a char that is constant" — that is, the char can't be changed via ptr.
char * const ptr means "ptr is a constant pointer to a char" — that is, you can change the char via ptr, but you can't change the pointer itself.
indian.21987's Avatar
Light Poster
got it

thanks a lot