typedef

How can P be a constant in the following code?
1
2
3

typedef char *charp;
const charp P;
the const on line 3 applies to the type charp. The type charp is a pointer to a char. So line 3 defines a const pointer to a char or in other words:

char *const P;

It means that you cannot modify the pointer while the object it points to you can
Topic archived. No new replies allowed.