Skip to main content
retagged
Link
xsl
  • 17.4k
  • 20
  • 74
  • 112
Source Link
Niklas
  • 5.8k
  • 8
  • 39
  • 42

What does a const pointer-to-pointer mean in C and in C++?

I know the rule-of-thumb to read declarations right-to-left and I was fairly sure I knew what was going on until a colleague told me that:

const MyStructure** ppMyStruct; 

means "ppMyStruct is a pointer to a const pointer to a (mutable) MyStructure" (in C++).

I would have thought it meant "ppMyStruct is a pointer to a pointer to a const MyStructure". I looked for an answer in the C++ spec, but apparently I'm not very good at that...

What does in mean in C++, and does it mean the same thing in C?