Lecture 25: Pointers as Output Parameters
Monday, April 30, 2012[Up] [Previous Lecture] [Next Lecture]
Reading Assigned: 6.1-6.2 and 8.5
Homework Due: None
Homework Assigned: Homework 12 -- assigned last class
Classwork Assigned: Classwork 14
Topics Covered:
- Homework 12 questions?
- Quiz 4 - Any questions for me to review?
- Reminder about how final grade is calculated (blackboard was updated)
- Pointers
- A pointer is a way to reference the memory that another variable occupies
- Can be used to pass multiple values back from a function
- Can also be used to simply pass a value to a function, using a pointer does not REQUIRE that the function modify the passed in value
- Operators used with pointers
- * - dereference operator (gives us the value the pointer points to)
- & - address of operator (gives us a pointer to a value)
- Pointer examples we missed in last class
- A program example
- A program using pointers to pass back a value
- A program using pointers to pass strings
- What is the difference between this example and the last example? How will the behavior differ?