Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
A very strange example.
There is no difference at all between and - both times const is applied to the type const [type]
- this is the double application of const to the type, which will cause a compilation error.
If const is after the asterisk, then the const operator is applied to the pointer.
That is
, equivalent options are also possible,
and
where const is applied to both the type and the pointer.
In simple words:
1. If const refers to the type (before the asterisk), then the data pointer cannot be changed
2. If const refers to a pointer (after the asterisk), then you cannot change the pointer itself [type] const
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question