assuming struct S is defined,
'const struct S *&' and 'struct S * const &'
using VC6
Printable View
assuming struct S is defined,
'const struct S *&' and 'struct S * const &'
using VC6
So the placement of the const determines what it is applied to? How do you determine what is constant and what isnt based on the type?
Yes.Quote:
So the placement of the const determines what it is applied to?
const only applies to the pointer when it's placed after the asterisk. For example, these two declarations are equivalent:Quote:
How do you determine what is constant and what isnt based on the type?
Meaning, MyVar can change, but *MyVar cannot. However,Code:const MyType* MyVar;
MyType const* MyVar;
means MyVar cannot change, but *MyVar can.Code:MyType* const MyVar;
Or if you like symmetry:
MyType const * const MyVar;