PIC10B_lecture2

PIC10B_lecture2 - Pointer arithmetic Array/Pointer duality...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Pointer arithmetic Array/Pointer duality law Using a pointer to step through an array Pointers A. Barbaro UCLA PIC 10B Pointer arithmetic Array/Pointer duality law Using a pointer to step through an array Outline for Today: Arrays and Pointers (7.4 of Big C++ ) 1 Pointer arithmetic 2 Array/Pointer duality law 3 Using a pointer to step through an array Pointer arithmetic Array/Pointer duality law Using a pointer to step through an array Recall how we declare an array of size 5: double a[5]; This line allocates memory for 5 doubles But what type, really, is a ? Pointer arithmetic Array/Pointer duality law Using a pointer to step through an array Recall how we declare an array of size 5: double a[5]; This line allocates memory for 5 doubles But what type, really, is a ? The value of a is a POINTER to the starting element This means, for example, that we could legally type: double* p = a; Pointer arithmetic Array/Pointer duality law Using a pointer to step through an array Recall how we declare an array of size 5: double a[5]; This line allocates memory for 5 doubles But what type, really, is a ? The value of a is a POINTER to the starting element This means, for example, that we could legally type: double* p = a; We can even dereference a : *a = 3.14159; This will set the first element of a to an approximation of !...
View Full Document

This note was uploaded on 10/23/2011 for the course PIC 10B taught by Professor Wittman during the Winter '08 term at UCLA.

Page1 / 17

PIC10B_lecture2 - Pointer arithmetic Array/Pointer duality...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online