Week 2 - Arrays

Week 2

Introduction to arrays and memory in C.

Arrays and Memory

Arrays are contiguous blocks of memory that hold elements of the same type. Here’s a small example in C:

#include <stdio.h>

int main(void) {
    int arr[5] = {1, 2, 3, 4, 5};
    for (int i = 0; i < 5; i++) {
        printf("%d\n", arr[i]);
    }
}

Practice: try writing functions that compute the max, min, and average of an array.