It is indeed a parameter passing technique -- there are only two ways to pass something, by value and by reference. Pass by reference can be done in one of two ways -- a pointer (C) or reference operator (C++). The three differences I can think of
1. use of dot or pointer operators within the receiving function
void foo(int* n)
{
*n = 0;
}
void foo(int& n)
{
n = 0;
}
2. use of '&' operator inside the passing function
int main()
{
int n;
foo(&n);
foo(n);
return 0;
}
3. They can be overloaded functions as shown in the examples above.
Otherwise, the dot and pointer operator compile down to the same identical code. Its all really just a matter of programmer preference.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Offline 21,950 posts
since Aug 2005