1/11
Flashcards on Pointers, Arrays, and Dynamic Memory Allocation in C++
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Array
Stores elements in contiguous memory locations; the array name acts as a pointer to the first element.
Array Name
The name of the array acts as a constant pointer to the first element.
Accessing Array Elements with Pointers
Access array elements using pointer arithmetic, e.g., *(ptr + i).
Pointer out-of-bounds access
Accessing memory outside the bounds of the allocated array.
Dynamic Memory
Memory allocated during runtime, providing flexibility for unknown sizes; requires manual management.
Static Memory
Memory allocated at compile time with fixed size.
new operator
Allocates memory at runtime; size can be determined at runtime.
delete operator
Deallocates memory, preventing memory leaks.
Memory Leaks
Allocating memory with 'new' but not deallocating it with 'delete', leading to memory accumulation.
Dangling Pointers
Accessing memory after it has been freed, leading to undefined behavior.
Pointers and Arrays Task
Using pointers to find the max and min values in an array.