I normally program in python. To increase performance of my simulations, I am learning C. I have a problem to understand the use of a pointer of a pointer when implementing
In essence, as Jite & the others said is correct.
Whenever you want to have a change applied to a data structure in C (change performed by another function), you need to pass a "reference" to this data structure for the change to persist beyond the change() function completes. This is what happens in Python too, you pass references to Objects unless you explicitly make a copy. In C you have to specify what you want to do precisely. To simplify it even more, it's either:
type data_struct
change(data_struct) => here's a copy of my data_struct, make your change but I do not care in the caller function about the change you apply
or
change(&data_struct) => here's the address (a "reference" to) of my data_struct, apply your change, the caller function will see this change after it is applied.
Now, depending of what the original "type" is, you might have * or **. Nevertheless, keep in mind that there is a limit to how many "indirections" you can have, not sure weather it is system or compiler determined, if anyone has an answer to that I'm a taker. I never had more than 3 indirections.