lec08-array_pointer2.pdf - CSCI 1120 Introduction to...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI 1120 Introduction to Computing Using C++ Arrays and Pointers (Part 2) 1 Fall, 2016
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Outline Why pointers? Pointers as parameters vs Reference parameters Relationship between pointers and arrays Passing arrays to functions Pointer Arithmetic 2
Image of page 2
3 Pointers as Parameters Pointers are passed by value. The address stored in one pointer variable (the actual argument) is copied to the another pointer variable (the formal parameter). Passing pointers allow us to emulate the effect of "pass by reference". When the callee receives the memory address, the callee can access the data stored at that memory address.
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon