When reading about const_cast
I came across sentences like the following:
Only the following conversions can be done with const_cast. In particular, only const_cast may be used to cast away (remove) constness or volatility.
1) Two possibly multilevel pointers to the same type may be converted between each other, regardless of cv-qualifiers at each level.
I've googled around a bit already and haven't found any concise, straightforward definitions of what a multilevel pointer is. So: what exactly is a multilevel pointer?
(Possible face-palm moment) It it just a pointer to a pointer, or pointer to a pointer to a pointer, e.g. int **
or int ***
?
Multilevel pointers: A pointer is pointer to another pointer which can be pointer to others pointers and so on is know as multilevel pointers. We can have any level of pointers.
A pointer is a variable that stores the memory address of another variable as its value. A pointer variable points to a data type (like int ) of the same type, and is created with the * operator.
Is it just a pointer to a pointer, or pointer to a pointer to a pointer, e.g.
int **
orint ***
?
It is exactly this, yes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With