basics · beginner · ~15 min

Larger of two

Produce a function the compiler accepts and links.

Challenge

Write code that compiles cleanly: implement int max2(int a, int b) returning the larger value.

Starter code

int max2(int a, int b) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.