Interview Questions

Difference between const char* p and char const* p

C Interview Questions and Answers


(Continued from previous question...)

Difference between const char* p and char const* p

in const char* p, the character pointed by ‘p’ is constant, so u cant change the value of character pointed by p but u can make ‘p’ refer to some other location.

in char const* p, the ptr ‘p’ is constant not the character referenced by it, so u cant make ‘p’ to refernce to any other location but u can chage the value of the char pointed by ‘p’.

(Continued on next question...)

Other Interview Questions