Is passing a variable or array to a function by pointer more convenient than passing it by value.On the other hand,does the c++ allocate a new space when you pass things by value? and is it worth burdening with dealing with pointers?
Thanks in advance
If you have an object which complex to copy, you should pass it by reference, not by pointer.
eg:
1 2 3 4 5 6
class myClass
{
// many things in here
};
void function ( const myClass ¶m ); // passing as const reference so you don't copy it and you can't modify it
For basic types as int, double etc. you can always pass by value