Perfect. I almost commented to complain that the “elegant” version is harder to read and understand. This is much much better. Comments are important!
Usually variable names in a loop is the object being manipulated not the address of that pointer which means p isn't a pointer to the object which makes it completely confusing.
If the article used pp which is the typical way you describe a pointer to pointer it'd help