basics · beginner · ~15 min
Implement a function matching a declared prototype.
Provide the implementation that matches a prototype a header would declare.
Header files declare functions that other source files implement. Implement int triple(int n) that returns 3 * n, matching its declared prototype. No main — the grader calls it.
A single int n.
Returns 3 * n, as an int.
triple(3) -> 9
triple(0) -> 0
triple(-2) -> -6
A single int n.
3 * n, as an int.
int triple(int n) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.