Dereference operator C++
hi, I got a question, what does it mean when the * is used twice. for example
**
what does that mean?
It dereferences the results of the previous dereference.
*edit: Naturally, you can do this indefinately.
However, think long and hard if you ever find yourself needing more than two dereferences at a time. There's a chance something is more complicated than it needs to be.
CM
int a;int* pa = &a*pa == a;int** ppa = &pa*ppa == pa;**ppa == *pa == a;
*edit: Naturally, you can do this indefinately.
int*** pppa = &ppa*pppa == ppa;**pppa == *ppa == pa;***ppa == **ppa == *pa == a;
However, think long and hard if you ever find yourself needing more than two dereferences at a time. There's a chance something is more complicated than it needs to be.
CM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement