-11
Segment computeSegment(Triangle& t, float z)
{
    Vertex** vs = t.vertices;
    // ...
}

Here, Vertex is the name of a structure. Can you tell me what is the meaning of ** in Vertex** vs = t.vertices;?

5gon12eder
  • 21,864
  • 5
  • 40
  • 85
mj9497
  • 35
  • 5
  • Learn the use of `*` and you will understand `**`. – Drew Dormann Jan 28 '15 at 20:17
  • Given the names of the variables, I assume that a `Triangle` has a member `vertices` that is a pointer to an array of pointers to `Vertex`es so `vs[0]` would give you a *pointer* to the first vertex. – 5gon12eder Jan 28 '15 at 20:22
  • 1
    Without `**` we could not have `***`, and then we could not have a [three star programmer](http://c2.com/cgi/wiki?ThreeStarProgrammer) – Yakk - Adam Nevraumont Jan 28 '15 at 20:29

1 Answers1

2

Vertex* is pointer-to-Vertex, so Vertex** is pointer-to-pointer-to-Vertex -- one more level of indirection.

For example:

int i = 0;
int * iPtr = &i;        // iPtr -> i
int ** iPtrPtr = &iPtr; // iPtrPtr -> iPtr -> i
cdhowie
  • 133,716
  • 21
  • 261
  • 264