The functions below are compiled as C17 on a system where unsigned char holds 8 bits (values 0 to 255).
int halfInt(double x) { return x / 2; } double meanInt(int a, int b) { return (a + b) / 2; } double meanReal(int a, int b) { return (a + b) / 2.0; } unsigned char wrapByte(int n) { return n; }
Each call in the table is printed with printf("%d\n", ...) when the function returns an integer type, and with printf("%.1f\n", ...) when it returns double. Enter exactly what each call prints, as a whole number or a number with one decimal place.
Unlock full course notes by signing up
Convert arguments before calculating ticks
A C17 timer helper produces four ticks per complete second. Its definition appears before the caller:
Inside a valid caller, the program executes:
What value is stored in total? Answer in ticks as an exact integer, to zero decimal places.
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.
Put the steps the program performs for this call in order, from the moment the call expression is reached until r receives its value.
Audit a set of function interfaces
A C17 program contains these prototypes, with matching implementations supplied elsewhere:
Each option is an independent proposed addition, placed in an appropriate scope. Select every addition permitted by strict C17 function declaration, call, and return rules.