Parameter Passing in C++

There are three parameter-passing modes in C++: by value, by pointer, and by reference.

When a parameter is passed by value, the changes made to the parameter within the function do not affect the value of the actual argument used in the function call. When a parameter is passed by pointer or by reference, changes made to the parameter do affect the actual arguments in the client space. In addition, there is a special mode of passing array parameters.

We will consider different modes of parameter passing, their syntax, and their semantics, and we will try to formulate guidelines for the use of C++ parameter-passing modes that provide the best performance and the best transmission of designer ideas to the maintenance ...

Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.