That an array is a data structure consisting of related data items
of the same type
That the size of an array needs to be determined by compile time
(you may not use a variable to define the size of an array)
That a pointer is an address
That a pointer must be declared to point to a particular data type
That C uses pointers to simulate call-by-reference
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:
Define and initialize an array
Process an array using iteration
Pass an array to a function
Declare a pointer
Initialize a pointer
Define and call a function that uses pointers as parameters
manipulate arrays using pointers instead of using subscripts
Sample Quiz Questions:
Write a C function that will determine the sum of the numbers
stored in an int array. The function is given the name of the array
and the number of elements in the array. Here is the function heading:
int sumElements (int theArray[], int size)
Write the complete function definition (function heading and function body)
for a C function called calculate
with the following pre- and post-conditions:
PRE: num is a non-negative float
POST: the function returns the square root of num, and the value of num squared
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 the previous problem using the const qualifier so that the array gets the
protection afforded by call-by-value.