CMPT 115 Lecture 3: references-notes

32 views11 pages
9 May 2016
School
Course
Professor

Document Summary

Notes written by michael horsch, mark eramian, ian mcquillan, lingling jin, and dmytro dyachuk. In c++, all variables have: a type: decided by the programmer, a name: decided by the programmer, a value: determined by the program, an address: determined at runtime by the os. Normal variable declaration mynum 7; memory looks like address contents. Advanced programming techniques that make use of addresses: work with compound data without copying the data (e. g. , arrays, records, organize large collections, make some calculations more e cient. Three new concepts: a new kind of type: reference (also called address ), an operator (&) to acquire the address of a variable, an operator (*) to use the address of a variable. These seem easy at rst, but these are the main source of program failure. In pseudocode and c++, if var is a variable name, then the expression &var is the address of that variable.

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