Whats the difference between const char *p, char const *p, and char * const p?
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; see question 1.21. References: ISO Sec. 6.5.4.1 Rationale Sec. 3.5.4.1 H&S Sec. 4.4.4 p. 81 comp.lang.c FAQ list · Question 11.11 Q: I’ve got the declarations typedef char *charp; const charp p; Why is p turning out const, instead of the characters pointed to? A: typedef substitutions are not purely textual. (This is one of the advantages of typedefs; see question 1.13.) In the declaration const charp p; p is const for the same reason that const int i declares i as const. The typedef’ed declaration of p does not “look inside” the typedef to see that there is a pointer involved. Additional links: further reading References: H&S Sec. 4.4.4 pp. 81-2 comp.lang.c FAQ list · Question 11.11b Q: What’s t