Skip to content
Brainlag

C playground

C
main.c
#include <stdio.h>

int main(void) {
    int scores[] = {7, 3, 9, 4};
    int total = 0;

    for (int i = 0; i < 4; i++) {
        total += scores[i];
    }

    printf("total = %d, average = %.2f\n", total, total / 4.0);
    printf("this int lives at %p\n", (void *)&total);
    return 0;
}
Output

Press Run.

Want lessons and checked exercises? Learn C

Code editor. Press Control or Command plus Enter to run the code. Tab indents; to move focus out of the editor, press Escape and then Tab.