ENGR 101 Lecture Notes - Lecture 9: Function Prototype, Dwayne Johnson

21 views3 pages
7 Aug 2018
School
Department
Course

Document Summary

A function is an abstraction over a chunk of computation. The interface for a function describes how we use it. The implementation contains code to make the function work. C++ does not allow returning more than one value and the return statement determines the return value. A variable can only be sued after its declared and only within a scope. Variables declared outside of the function have a global scope. To make a variable that will never change, use the fucntion const. Almost all other variables have a local or block scope. A block is a chunk of code enclosed by {}. Block scope also applies to control flow structures like if, for and while. A function prototype declares a function before it is actually defined. Different scopes can have variables with the same name . There are two mechanisms for parameter passing in c++:

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