Interview Questions

What is the difference between const char

C Interview Questions and Answers


(Continued from previous question...)

What is the difference between const char

Q: What's the difference between const char *p, char const *p, and char * const p?

A: The first two are interchangeable; they declare a pointer to a constant character (you can't change any pointed-to characters). char * const p declares a constant pointer to a (variable) character (i.e. you can't change the pointer).
Read these declarations ``inside out'' to understand them;

(Continued on next question...)

Other Interview Questions