Eroxl's Notes
Static Array

Static arrays in C are fixed-size arrays whose length is a compile-time constant. They occupy a contiguous block of memory of size N * sizeof(T) for a declaration like T arr[N].

Arrays are laid out contiguously (arr[0]arr[N-1] are adjacent in memory). Indexing is defined in terms of pointer arithmetic (arr[i] is *(arr + i)). Bounds are not checked at runtime; accessing out of range is undefined behavior.

Example

// Automatic storage duration (typically on the stack)
void f(void) {
		int arr[4] = {1, 2, 3, 4};
		// sizeof gives total bytes of the array object
		size_t bytes = sizeof arr;        // 4 * sizeof(int)
		size_t len   = sizeof arr / sizeof arr[0]; // 4
}

// Static storage duration
static char buf[256];   // lives for entire program