Sequence the steps of a prototyped call

A C17 program contains the prototype and call below. The variable w is an int, and the call appears after the prototype is in scope. Assume area finishes by executing a return statement with a value.


C
double area(double width, int height);

int w = 4;
double r = area(w, 3);


Put the steps the program performs for this call in order, from the moment the call expression is reached until r receives its value.

  1. 1.

    Control goes back to the caller, and the returned value initializes r.

  2. 2.

    The return expression is evaluated and its value is converted to double, the declared return type.

  3. 3.

    The arguments w and 3 are evaluated and converted to their corresponding parameter types, with no required order between the arguments' preparation.

  4. 4.

    The statements of the function body run until a return statement is reached.

  5. 5.

    The parameters width and height receive copies of the converted argument values.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Functions and Void Return Types Questions: