pointer to pointer
I am writing a function using borland c++ builder 6 to accept a pointer to a pointer to an image ;) (yes, pointer to pointer) but the syntax doesnt seem to work for me.
this is my function header:
void __fastcall TForm1::AdjustImage (TImage** ipp, int v, int h)
now that compiles fine, but the errors come when I need to dereference (and derefence again) that ipp variable.
A TImage has a "parent" properly, but "**ipp.parent" doesnt work, the "ipp->->parent" approach doesnt work either. How is this done?
(*ipp)->parent or (**ipp).parent.
**ipp.parent will not work due to precedence; direct member access (. operator) is higher on the list than deference (* operator); thus the parens.
**ipp.parent will not work due to precedence; direct member access (. operator) is higher on the list than deference (* operator); thus the parens.
just remeber this simple policy (which is true about 80% of the time):
any time you use * to dereference with ANY OTHER member operations, you should enclose it in parenthesis.
so when you do:
(*it).Foo();
or
(*it)->SomeFunc();
but not necesasry when put with non-member expression / statement operators:
curr = prev
*curr = *prev
(*curr).next = *prev
etc.
any time you use * to dereference with ANY OTHER member operations, you should enclose it in parenthesis.
so when you do:
(*it).Foo();
or
(*it)->SomeFunc();
but not necesasry when put with non-member expression / statement operators:
curr = prev
*curr = *prev
(*curr).next = *prev
etc.
Thank you both for your responses :) I have the feeling that this has happened to me in the past then forgotten about it :(
Thanks again :)
Thanks again :)
Quote:Original post by xyuri
..blah.. a pointer to a pointer to an image ;) (yes, pointer to pointer)
Is this supposed to be something clever? A pointer to a pointer, big wow.
Quote:Original post by Anonymous PosterQuote:Original post by xyuri
..blah.. a pointer to a pointer to an image ;) (yes, pointer to pointer)
Is this supposed to be something clever? A pointer to a pointer, big wow.
Thanks for the contribution. Do feel free to log in next time.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement