Pointer to Constants


What is the difference between const char* p and char const* p?

✍: FYIcenter


In const char* p, the character pointed by "p" is constant, so you can not change the value of character pointed by p but u can make "p" refer to some other location.

In char const* p, the pointer "p" is constant not the character referenced by it, so you can not make "p" to refernce to any other location but u can chage the value of the char pointed by "p".

2007-02-26, 6476👍, 0💬