0

Changing pointer address via function

I tried to pass a double pointer into a void function as an argument. The double pointer points to the first element of a matrix. How do I write a prototype of that function so that I can change the address of my pointer? I tried writing int &**p but I can't get it to work.

26th Jul 2020, 5:52 PM
ja008
ja008 - avatar
1 Réponse
+ 1
You need a int*** (or float*** etc) That is, a pointer to your matrix. It might help to typedef your matrix, all these stars can get mighty confusing: typedef int** matrix; And then all you need is a pointer to `matrix`, or `matrix*` :)
26th Jul 2020, 5:57 PM
Schindlabua
Schindlabua - avatar