There is a very simple rule to read (all!) C/C++ declarators.
Let's suppose we see this declarator (**image) in an expression. What can we dereference with * operator in C/C++ language? Only pointers, of course. Well, image is a pointer. We have two * operators (right to left binding). So the result of the 1st (right side op must be dereferenced i.e. it's a pointer too. OK, image var must be pointer to pointer.
Now see on a simple type starting this declaration (char). Result of two dereferencing ops (*(*)) must be char.
Conclusion: we have (we declare) pointer to pointer to char!
Try to apply this rule in other cases (for typedefs too). It works...
There is also a minor point of style. Some people write
char** image, wow;
Others write
char **image, wow;
They both mean the same thing but the former implies that wow is a char** when it is actually a char. When your in the depths of debugging, such declarations don't help. With the latter, it is obvious that it is a char. If you are going to use the first format, declare your variables separately
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.