Repair a function that changes only its parameter

The starter intends to add five to a mark, capped at 100, but main does not print the intended result. Explain the actual output using distinct caller and callee objects. Repair it WITHOUT global variables or pointer parameters: the function must return the adjusted value, and the caller must use that return value.

    Your corrected complete program should read mark in 0..100, print mark=M after the adjustment, and print invalid for failed/out-of-range input. Include tests for 0, 94, 95, 98 and 100. Explain one benefit of the small function and one cost/tradeoff of decomposing code into functions; do not claim that every function call necessarily remains as runtime overhead after optimization.

Assume every integer token supplied is representable in int.

#include <stdio.h>
void add_bonus(int mark)
{
    mark += 5;
    if (mark > 100) {
        mark = 100;
    }
}
int main(void)
{
    int mark = 98;
    add_bonus(mark);
    printf("mark=%d\n", mark);
    return 0;
}

