23 example of pointer use includestdioh void

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: ++) sum += *(px+i); sum += x[i]; 19 Pointers and Arrays (cont’d) •  Recall that the name of an array is the address of the ini1al element of the array. –  Thus these two assignments are equivalent: py = &y[0]; py = y; •  However, there is one difference between a pointer (py) and an array name (y): –  A pointer is a variable, thus py++ and py = y are legal statements –  An array name is not a variable, thus y++ and y = py are illegal statements 20 Pointers and Arrays (cont’d) •  When we pass an array name to a func1on, we are passing the memory loca1on of the ini1al element (passing by reference) –...
View Full Document

Ask a homework question - tutors are online