Functions and Memory in C: Allocating Memory on the Heap
C programming
| Intermediate
- 11 videos | 1h 32m 2s
- Includes Assessment
- Earns a Badge
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, you'll 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.
WHAT YOU WILL LEARN
-
Discover the key concepts covered in this courseContrast stack and heap memoryUse malloc() to allocate memory on the heapUse the free() method to free stack memory that is not allocatedAllocate space for arrays using malloc()Return pointers to heap locations from functions
-
Distinguish between dangling memory and memory leaksContrast malloc(), calloc(), and realloc()Create pointers on struct objectsCreate pointer fields in structsSummarize the key concepts covered in this course
IN THIS COURSE
-
2m 34s
-
11m 18sFind out how to compare stack and heap memory. FREE ACCESS
-
8m 4sIn this video, find out how to use malloc() to allocate memory on the heap. FREE ACCESS
-
11m 2sIn this video, you will use the free() method to free stack memory that is not being used. FREE ACCESS
-
10m 23sIn this video, learn how to allocate space for arrays using malloc(). FREE ACCESS
-
9m 49sIn this video, you will return pointers to heap locations from functions. FREE ACCESS
-
10m 5sIn this video, you will learn the difference between dangling memory and memory leaks. FREE ACCESS
-
8m 21sDuring this video, you will learn how to use malloc(), calloc(), and realloc(). FREE ACCESS
-
7m 18sDuring this video, you will learn how to create pointers to struct objects. FREE ACCESS
-
9m 17sDuring this video, you will learn how to create pointer fields in structures. FREE ACCESS
-
3m 52sbb960bfb-bfd9-4590-a6be-2598621fe8b1 FREE ACCESS
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.
Digital badges are yours to keep, forever.