This question already has an answer here:
- typedef pointer const weirdness 5 answers
- const, pointers, typedefs and stars [duplicate] 2 answers
Consider the following code,
const char *pstring;//pstring is a pointer to char
char *const pstring1;//pstring1 is a const pointer to char
Now consider the following example of type alias,
typedef char *pstring;//pstring is synonym for pointer to char
const pstring cstr = 0;
If we interpret pstring in the second statement as char*,then
how is cstr a const pointer to char and not a pointer to const char?
Aucun commentaire:
Enregistrer un commentaire