Question 11.9

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


const char *p declares a pointer to a constant character (you can't change the character); char * const p declares a constant pointer to a (variable) character (i.e. you can't change the pointer).

Read these ``inside out'' to understand them; see also question 1.21.

References: ANSI Sec. 3.5.4.1 examples
ISO Sec. 6.5.4.1
Rationale Sec. 3.5.4.1
H&S Sec. 4.4.4 p. 81


Read sequentially: prev next up top


This page by Steve Summit // Copyright 1995 // mail feedback