Lecture 1 - Slide 28 : 34
Call-by-reference parameters via pointers
A
call-by-reference parameter
in C is a pointer passed as a
call-by-value parameter
Motivation
Output parameters
Input parameters: Avoid copying large data structures
Examples
The struct functions discussed earlier
Structs and functions
A C program with a swap function.
C++ Preview: A similar C++ program with a swap function - uses references.
C++ offers a
reference type
that establishes an alias to an existing location in memory