Jacky wrote:
if I have following statements...
int *foobar;
class foobar2
{
};
foobar2 foobarx = new foobar2();
This already won't compile.
would I choose this one
int foo(int *foobar); //copy foobar pointer to foo
or
this
int foo(int& *foobar); // no copy but pass foobar as an altered
pointer...
which of these is more efficient
Impossible to tell. Please, for your own sake, refrain from thinking in
terms of performance for now, i.e. until you have the C++ basics down. The
two functions simply do different things, at least they implicitly say so.
The first one says "this function takes a pointer, which can be null, to
an
int that is modified inside the function".
The second one says "this function takes a reference to a pointer. Inside
the function both the pointer as well what it points to will be modified".
Actually it says a pointer to a reference... which is complete nonsense and
shouldn't compile either. If you take the address of a reference
identifier, you get the address of the variable it aliases... there is no