ENGR 101 Lecture Notes - Lecture 15: Clarity, Ampersand, Data Element

15 views5 pages
24 Jan 2017
School
Department
Course

Document Summary

Functions in c++ and ways to pass data. Recall: avoid repetition in code repetition leads to errors because there are more opportunities for typos. Prepetition makes debugging more difficult because mistakes are repeated future users find codes that involve repetition harder to read and harder to understand functions encapsulate algorithms so they can be written once and used repeatedly. Pass-by-value copies the data from the caller to a new location in the algorithm. When pass-by-value is used to send data back to the caller, this is called a return the caller has the option to ignore this kind of returned data. Pass-by-reference gives direct access to the data in the caller"s environment the caller cannot ignore pass-by-reference data sent to it since the data was directly changed. Data inside of main can be changed by that function. You want to make sure it"s not changed.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents