Kodewick
Start learning →
Starter←→0 / 70

Pick up coins

#049StarterPointers3 min

In a little game you have 5 coins, and p points to coins (it holds where coins lives). You find 3 more: add 3 to coins through p, without writing coins.

Should show
coins: 8
main.c
#include <stdio.h>

int main(void) {
    int coins = 5;
    int *p = &coins;
    // your code here: add 3 through *p
    printf("coins: %d\n", coins);
    return 0;
}
Ctrl + Enter runs too
Result

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