Parameter Passing in C++
CS2 / C++
The activity leads students to explore the 3 parameter passing mechanisms in C++, pass-by-value, pass-by-reference, and pass-by-const-reference, by exploring code using pythontutor.com in C++ mode. The students will discover how values can be passed into a function, strictly out of a function, and both in and out of a function. The activity will also have the students think about the efficiency of passing large data structures (large arrays or long strings) as parameters.
This activity was developed with NSF support through IUSE-1626765. You may request access to this activity via the following link: IntroCS-POGIL Activity Writing Program.
- Level: Undergraduates
- Setting: Classroom with movable furniture
- Activity Type: Learning Cycle
- Discipline: Computer Science
- Course: CS2 / C++
- Keywords: C++, parameter passing, data structures.
How to Cite
Copyright of this work and the permissions granted to users of the PAC are defined in the PAC Activity User License.