Is this a const pointer?

The statement
int const*ptr=&<any variable>;

Does not give any syntax erro.. But what is this??
int const*ptr=&<any variable>;
I believe any variable is a type of int? Otherwise you would get an error: http://coliru.stacked-crooked.com/a/609461943db118bf

If it an int or const int, then your code is valid: it creates a pointer to constant integer, so you cannot change value it points to. It can point to const int (exact type) or plain int (stronger qualifier, more restrictions), but cannot point to volatile or const volatile int (discards qualifiers)
Topic archived. No new replies allowed.