const Correctness: Difference between Foo* const ptr, const Foo* ptr, const Foo* const ptr
Posted by tekpool on January 10, 2007
- Foo* const ptr: ptr is a const pointer to a Foo Object. The Foo object can be changed using the pointer ptr, but you can’t change the pointer ptr itself.
- const Foo* ptr: ptr points to a Foo object that is const. The Foo object can’t be changed via ptr.
- const Foo* const ptr: ptr is a const pointer to a const Foo object. Neiher can the pointer ptr be changed, nor can you change the Foo object using ptr.
Reading the declaration right to left is a easy way to remember what they mean.
Sharad Upadhyay said
Hi Andreas,
Can you please post your comment of O(1) space merge of two sorted arrays? It would be good to know how it works. It is needed for O(NlogN) time and O(1) space merge sort algorithm. Most of the books talk about extra O(N) space solution, please let me know which book explain O(1) space merge sort.
Marinkina said
Пора переименовать блог, присвоив название связанное с доменами
может хватит про них?