Thursday, November 20, 2008

Difference between const char *p, char const *p, and char* const p

Q.What is the difference between const char *p, char const *p, and char* const p ?

Answer: 'const char *p' and 'char const *p' are the same, i.e. p points to a constant character. On the other hand, 'char* const p' means p is a constant pointer pointing to a character which means we cannot change the pointer p but we can change the character which p is pointing to.

No comments:

Blog List