2012Week03Lecture3

A local variable containing an address by using this

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: rays (cont’d) •  Pointer arithme1c opera1ons: –  Now, since py points to a par1cular element in array y (y[0]), then py+1 will point to the next element in the array. •  py+i will point to i elements aeer py •  py-i will point to i elements before py •  Thus, if py points to y[0], then *(py+1) refers to the contents of y[1]. 18 Pointers and Arrays (cont’d) •  Regardless of the type or size of the variables in array y, when we add i to a pointer (e.g. py+i), we point to the i- th object beyond py. •  Pointer nota1on and array nota1on: int i, *px, x = {4,5,9}; int i, *px, x = {4,5,9}; int sum = 0; int sum = 0; px = x; px = x; for(i=0; i < 3; i++) for(i=0; i < 3; i...
View Full Document

Ask a homework question - tutors are online