{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

PIC10B_lecture2

# PIC10B_lecture2 - Pointer arithmetic Array/Pointer duality...

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

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

View Full Document

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

View Full Document

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

View Full Document
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

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online