Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > I thought I und...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 43646 of 47563
Post > Topic >>

I thought I understood pointers.

by "noagbodjivictor@[EMAIL PROTECTED] " <noagbodjivictor@[EMAIL PROTECTED] > Mar 3, 2008 at 06:30 AM

Hi all,

I thought I knew how pointers work, but then I'm struggling with a
code, well I happen to have written last semester in my data structure
class. Why do we pass the pointer to the node of a binary tree by
reference? Isn't a pointer supposed to hold the address of an object
in memory?

Take this for example:
ItemType findMax(TreeNode* & tree) {
  while(tree->right != NULL)
    tree = tree->right;
  return tree->info;
}

Why are we are passing the pointer tree by reference here? Don't be
too harsh, I just happen to have forgotten a little bit...
 




 5 Posts in Topic:
I thought I understood pointers.
"noagbodjivictor@[EM  2008-03-03 06:30:14 
Re: I thought I understood pointers.
Kai-Uwe Bux <jkherciue  2008-03-03 09:45:49 
Re: I thought I understood pointers.
"Eric Pruneau"   2008-03-03 10:05:42 
Re: I thought I understood pointers.
"noagbodjivictor@[EM  2008-03-03 07:29:16 
Re: I thought I understood pointers.
kasthurirangan.balaji@[EM  2008-03-03 21:31:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 8:22:52 CDT 2008.