Assessment Tool
Lecture 13: Pointer Parameters
Content Tested: Pointers
Lecture Content:
-
Function parameters
-
Call by value
-
Pointer parameters
-
Call by reference
-
Pointer types
Goals:
-
Learn concepts and theories
-
Develop capacity to think for oneself
-
Develop ability to apply principles and generalizations already learned
to new problems and situations
-
Develop ability to think creatively
Assessment Technique: Application Cards
Purpose:
To allow instructors to find out if students understand the need and use
for pointer parameters.
Activity:
We have just seen the syntax and purpose for using pointer parameters.
Name three functions for which you would use pointer parameters.
For this activity, please describe the following: 1) function name,
2) function parameters, 3) function description, 4) return values.
Please indicate which parameters are pointer parameters. You do not
need to write C code for this activity -- just descriptions of the functions.
You may want to think about previous homework assignments. Where
would you use pointer parameters?
Possible Solution:
function: sortThree
function parameters: 3 pointers to ints (*a, *b, *c)
function description: This function takes three pointers to ints
and sorts them so that a points to the smallest value, b points to the
middle value, and c points to the largest value.
return values: None
Possible Uses of Activity:
-
Have students work on the activity individually and then get into small
groups to explain their functions to one another.
-
Have students work on the activity in small groups and have each group
present their functions to the class.
-
Be sure to address why pointer parameters are necessary and useful.
If some functions can be easily written without pointer parameters, point
this out to the students. Also, you might try to come up with call-by-value
solutions to functions using pointer parameters. For example, instead
of using sortThree, a programmer could write the functions findMin, findMiddle,
and findMax and use the return values of these to assign to a, b, and c.