Assessment Tool

Lecture 13:  Pointer Parameters

Content Tested:  Pointers

Lecture Content:

Goals:

Assessment Technique:  Mini-Drama

Purpose:

To allow instructors to find out if students understand pointer parameters and call by reference.  In this activity students will "act out" a short piece of code involving pointer parameters.
 

Activity:

We have just seen the syntax and purpose for using pointer parameters.  Today we will learn more about a function you saw in today's lecture.  As a class, we will act out a mini-drama that demonstrates the execution of the following code.

/* interchange *p and *q */
void swap (int *p, int *q) {
    int temp;
    temp = *p;
    *p = *q;
    *q = temp;
}

/* somewhere in another function */
...
int a, b;
a = 4;
b = 7;
swap(&a, &b);



The instructor should ask for volunteers or assign roles for the following parts:
The variable a
The variable b
Pointer to variable a
Pointer to variable b
The variable temp

It will probably work best if the instructor leads the drama as the controller of the instructions.

For example, the person representing variable a would be assigned the value 4 (maybe the instructor could use a visual card with "4" printed on it) by holding this card.  Similar actions could take place for variable b and temp.  Students taking on pointer roles should point to the appropriate cards held by other students.

Encourage the students not participating as an actor to help lead the actors to accomplish their tasks.  In fact, the instructor might add the restriction that the actors should only take the actions suggested by other members of the class.

Once the drama is finished, the instructor should go over the correct actions in the program.  As a final piece of this activity, ask the students the types of each actor (int or pointer to int).

Possible Uses of Activity: