|
-
October 31st, 2007, 02:35 PM
#1
Pointers, passing by reference, and good 'style'
I was reading on pointers in a PDF I found on the tubes, and I noticed that a code example uses pointers to do a pass by reference.
In C++ I last spring, when we wanted to pass a value by reference, we used int& someVar; for the variable in the parameter. The PDF uses int* someVar; instead. As far as I know, they do the same thing with no extra abilities given / taken from each one. Which is the more common, or preferred method?
Also, are pointers just like reference variables but involving two named variables (pointer, pointee), and not constricted to a parameter, or is there more?
M.
Programmer in the making...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|