Sign in to follow this  
xyuri

pointer to pointer

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
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.


Thanks for the contribution. Do feel free to log in next time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this