Pointers and References in C++: Allocating Memory with New & Delete Operators
C++ 20
| Intermediate
- 13 Videos | 1h 25m 18s
- Includes Assessment
- Earns a Badge
C++, like C, has powerful support for memory allocation and deallocation. In the world of C, these operations are performed using malloc() and free(), which are not to be used in the C++ world. In classic C++, memory allocation and deallocation are performed using the new and delete operators. You will begin this course by understanding the new and delete keywords, and note how these lead to the invocation of the underlying constructors and destructors on whatever objects are being worked with. In contrast, the C versions, that is, malloc() and free(), do not invoke constructors or destructors. You will then move on to the use of array new and array delete, which is how the new and delete followed by square brackets are referred to. Finally, you will look at the differences between const pointers and pointers to consts.
WHAT YOU WILL LEARN
-
discover the key concepts covered in this courseexplore pointers and stack and free store memorycontrast malloc() and newuse the new keyword to allocate memory on the heapuse the new and delete keywords on pointersallocate memory for strings and vectorsallocate memory for arrays using array new and delete
-
invoke constructors and destructors on arrayscontrast const pointers and pointers to constscreate constant variables and pointers on those variablescreate constant pointers on constant and non-constant variablescreate constant pointers and constant pointers to constantssummarize the key concepts covered in this course
IN THIS COURSE
-
1.Course Overview2m 8sUP NEXT
-
2.Understanding the Use of Pointers6m 2s
-
3.Allocating Memory in C++7m 29s
-
4.Allocating Memory Using the new Keyword6m 49s
-
5.Understanding Finer Points of New and Delete7m 49s
-
6.Creating Strings and Vectors on the Heap6m 37s
-
7.Allocating Memory for Arrays on the Heap5m 20s
-
8.Exploring Finer Points of Array New and Delete7m 53s
-
9.Const Pointers versus Pointers to Consts7m 46s
-
10.Using Constant Variables and Pointers8m 34s
-
11.Creating Pointers to Constants8m 6s
-
12.Creating Constant Pointers7m 30s
-
13.Course Summary3m 15s
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion of this course, which can be shared on any social network or business platform
Digital badges are yours to keep, forever.