Pointers and References in C++: Allocating Memory with New & Delete Operators

C++    |    Intermediate
  • 13 videos | 1h 25m 18s
  • Includes Assessment
  • Earns a Badge
Rating 4.1 of 10 users Rating 4.1 of 10 users (10)
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 course
    Explore pointers and stack and free store memory
    Contrast malloc() and new
    Use the new keyword to allocate memory on the heap
    Use the new and delete keywords on pointers
    Allocate memory for strings and vectors
    Allocate memory for arrays using array new and delete
  • Invoke constructors and destructors on arrays
    Contrast const pointers and pointers to consts
    Create constant variables and pointers on those variables
    Create constant pointers on constant and non-constant variables
    Create constant pointers and constant pointers to constants
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 8s
  • 6m 2s
  • Locked
    3.  Allocating Memory in C++
    7m 29s
  • Locked
    4.  Allocating Memory Using the new Keyword
    6m 49s
  • Locked
    5.  Understanding Finer Points of New and Delete
    7m 49s
  • Locked
    6.  Creating Strings and Vectors on the Heap
    6m 37s
  • Locked
    7.  Allocating Memory for Arrays on the Heap
    5m 20s
  • Locked
    8.  Exploring Finer Points of Array New and Delete
    7m 53s
  • Locked
    9.  Const Pointers versus Pointers to Consts
    7m 46s
  • Locked
    10.  Using Constant Variables and Pointers
    8m 34s
  • Locked
    11.  Creating Pointers to Constants
    8m 6s
  • Locked
    12.  Creating Constant Pointers
    7m 30s
  • Locked
    13.  Course Summary
    3m 15s

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.

YOU MIGHT ALSO LIKE

Rating 4.5 of 18 users Rating 4.5 of 18 users (18)
Rating 4.5 of 6 users Rating 4.5 of 6 users (6)
Rating 4.5 of 26 users Rating 4.5 of 26 users (26)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 3.9 of 46 users Rating 3.9 of 46 users (46)
Rating 4.2 of 46 users Rating 4.2 of 46 users (46)
Rating 4.5 of 53 users Rating 4.5 of 53 users (53)