Functions and Memory in C: Allocating Memory on the Heap
C programmers can commonly use two kinds of memory: stack and heap. While stack memory is used to store local variables and is fully managed by C it does have major limitations that are mitigated by heap memory. In this course you will compare stack and heap memory exploring the advantages and limitations of each. Then you will allocate memory using the malloc() function and deallocate memory using free(). Next you will examine dangling memory issues that can cause potentially dangerous security issues. You will also explore other common allocation functions like calloc() to zero out memory and realloc() to help when you underestimate how much memory an array will require. Finally you will focus on pointers to struct objects. After completing this course youll be able to allocate memory malloc calloc and realloc; free memory; use pointers to structs; and avoid problems related to dangling pointers and memory leaks.