What is **a?

If a is a 3x3 matrix, I understand that ** means pointer to a pointer, but why does **a return the value at a[0][0]?
Read "Arrays and Pointers": http://www.cplusplus.com/doc/tutorial/pointers/

Its doing the same thing but with 2D arrays:

1
2
3
4
5
6
7
*(a+i) // a[i]
*(a[i]+j) // a[i][j]
*(*(a+i)+j) // a[i][j]

// so therefore....

*(*(a+0)+0) // a[0][0] = *(*(a)) = **a  
Last edited on
Topic archived. No new replies allowed.