1/21
Flashcards covering arrays, memory allocation, and strings in C.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Array
Collection of a primitive data type in C.
Statically typed arrays
Arrays where the array can only store one type of data.
Stack Memory
Memory reserved for static program data, managed by the compiler, and a last-in-first-out (LIFO) data structure.
Heap Memory
Memory available for dynamic program data, accessed through pointers, and a flexible unordered address space.
For loops
Operating on arrays requires us to iterate through the data structure
Zero
Arrays and other variables are not automatically initialised to _ in C.
Inline
C allows definition and initialisation of arrays _, similarly to primitive data types.
Matrix
A 2-dimensional array.
Right-most
For high-performance applications it is important to access arrays such that the _ index varies fastest.
String
An array of char type with an additional null character ('\0') that signifies the end of the string.
The C library that defines common string handling operations.
Static arrays
Arrays allocated at compile-time using stack memory.
Variable-length arrays (VLAs)
A C99+ language feature using stack memory, not resizeable once allocated.
Dynamic arrays
Original language feature using heap memory.
Pointer
A data type that can store a memory address.
malloc
C standard library utility functions: Allocate an item of given type.
calloc
C standard library utility functions: Allocate an array of a given type.
free
C standard library utility functions: Release allocated memory.
sizeof()
A portable way of calculating the correct amount of memory, which uses the locally defined amounts for that machine.
realloc()
The standard library utility for resizing allocated memory.
Garbage collection
The concept where many languages allocate and deallocate (free) dynamic memory silently.
Array-pointer duality
The properties where arrays and pointers are closely linked in C.