Note: we're told that i
is 2.
f->numberofpolygons = 1;
f->polygonlist = new tetgenio::polygon[f->numberofpolygons];
Now f->polygonlist
points to an array of size 1
.
// Two irrelevant statements skipped
tetgenio::polygon *p = &f->polygonlist[i];
p
is now the address of the third (i == 2
) polygon in f->polygonlist
. Oh, but f->polygonlist
points to an array of size 1
.