The course is part of this learning path
In this course, we will explore the basic concepts and fundamentals of pointers in C++ and you'll learn how to use them to point to dynamically allocated memory.
Learning Objectives
- Learn the fundamentals of pointers
- Learn how to allocate memory dynamically and also how to return it
- Explore rectangle and circle classes and create instances of them dynamically
Intended Audience
- Beginner coders, new to C++
- Developers looking to upskill by adding C++ to their CV
- College students and anyone studying C++
Prerequisites
To get the most out of this course, you should have a basic understanding of the fundamentals of C++.
In this section, we will learn about using pointers, a topic that a lot of students and developers unlike find a bit intimidating, but that's often because it's either taught poorly or sometimes misunderstood. I think if you follow along carefully, review where necessary and practice that both, the syntax and concepts will be fairly clear to you by the end of the section. We will explore not only the very basic concepts and fundamentals but also where the power of pointers lie, in pointing to dynamically allocated memory. We will see how to allocate memory dynamically and also how to return it when we're done. The types of pointers we will use in this section are also called raw pointers. They have been around since C++ began, starting with the C++ 11 standard. Many people use so-called smart pointers or managed pointers. We won't be covering those in this section. We'll cover smart pointers later in the course. Pointers are an amazingly powerful tool, especially when coupled with dynamic memory allocation. They help us create objects as needed rather than having to know ahead of time exactly how many of something you'll need. This helps us to use memory efficiently, which is often very important in industrial projects and memory intense applications of all sorts, and also helps us to do things we wouldn't be able to do otherwise creating objects on the fly or even in a randomized manner. So, we are in for learning a lot of important things in this section. At the end of this section, we'll work on a couple of really cool projects too. We'll revisit our rectangle and circle classes, but create instances of them dynamically instead of in a compile-time fashion like we did before. Let's get going.
John has a Ph.D. in Computer Science and is a professional software engineer and consultant, as well as a computer science university professor and department chair.