Lecture 8:  Function Parameters

Activity:  Drama



We have just seen the purpose of using and the syntax for creating functions in a program.  Today we will learn more about the process of a function call which you saw in today's lecture.  In a group of 3-4 people, design a mini-drama that demonstrates the function call process for the following code:

int main (void)
{
    double x, y, z;
    y = 6.0;
    x = area(y/3.0);
    z = 3.4 * area(7.88);
    return 0;
}

/* Find area of circle with radius r */
double area (double r)
{
    return (3.14 * r * r);
}
 

You may want to split up the roles as the "main" person, the "area" person, and the "controller" who commands the execution.  Props such as cards or pieces of paper with variable names and values might also be helpful.

After spending about 5 minutes creating your drama, we will share these with the rest of the class.