Arrays, strings and pointers

This part of the C course is the memory model at its most direct: arrays, the NUL-terminated string, the functions of ctype.h and string.h, and the pointer that ties them together. It shows how an array decays to a pointer, how pointer arithmetic walks one, and how a function pointer becomes a callback or a table of operations.

5.1 Arrays declaration, initialisation, bounds, iteration, sizeof Open 5.2 Strings char arrays, the NUL terminator, literals, traversal Open 5.3 Characters and ctype.h ASCII, char signedness, isalpha, toupper Open 5.4 The string.h functions strlen, strcpy, strcat, strcmp, strstr, memcpy Open 5.5 Safe string handling bounded copies, snprintf, truncation, buffer overflows Open 5.6 Pointers addresses, dereference, NULL, pointers as out-parameters Open 5.7 Pointer arithmetic and arrays decay, pointer arithmetic, one past the end Open 5.8 Function pointers declarations, callbacks, tables of functions, qsort Open

Lessons