Kodewick
Start learning →
Starter←→0 / 70

Scoreboard

#050StarterPointersFunctions3 min

Basketball scoreboard: add_point(&home) should give the home team 1 point. The function gets score, the address of home; add 1 through it. main calls it three times, so it should print Home: 3.

Should show
Home: 3
main.c
#include <stdio.h>

void add_point(int *score) {
    // your code here: add 1 to the number score points to
}

int main(void) {
    int home = 0;
    add_point(&home);
    add_point(&home);
    add_point(&home);
    printf("Home: %d\n", home);
    return 0;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.