Lecture 11 Objectives
At the end of today's class you should
KNOW:
- That an array name is an address
- That pointers can be used to access arrays
- That the sizeof operator determines the number of bytes in a data type,
or in a variable or expression
- That arithmetic on pointers depends on the size of the objects being
pointed to
BE ABLE TO:
- manipulate arrays using pointers instead of using subscripts
Sample Exam Question:
- In C, there is no way to pass an array by value. Give an example of
a function in which this restriction is a liability (in other words,
give an example of a function for which it would be preferable to be able
to pass the array by value).
- (Read section 7.5 before trying this question.) Modify your function
from problem 1 using the const qualifier so that the array gets the
protection afforded by call-by-value.