basics · beginner · ~15 min
Provide a definition for a declared function.
Implement int negate(int n) returning -n.
int negate(int n) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.