We may earn an affiliate commission when you visit our partners.
Umar Lone

C & C++ are very powerful languages when it comes to performance & flexibility. But there are some features that are complex and take time to master. One of such features is pointers. Pointers is what separates C/C++ from other languages. These are incredibly powerful as they allow programs to access memory directly and manipulate it.

Read more

C & C++ are very powerful languages when it comes to performance & flexibility. But there are some features that are complex and take time to master. One of such features is pointers. Pointers is what separates C/C++ from other languages. These are incredibly powerful as they allow programs to access memory directly and manipulate it.

This course focuses on pointers and their applications.It leans more towards implementation in C++, rather C. You'll learn the basics of pointers and then move on to understanding and implementing arrays, pointers to arrays & heap based arrays. You'll also learn advanced memory management by creating a custom dynamic array (just like std::vector<T> in standard C++ library). You'll use placement new & delete to directly place objects in a memory pool allocated through operator new function. As you'll see later in the course, this is a powerful mechanism to optimize usage of heap memory with user-defined objects.

After arrays, you'll learn how to use pointers to create node-based data structures. We'll focus on two types of linked lists - singly & doubly linked lists. You'll understand the difference between arrays and lists and also learn how to access the elements of both the data structures without having to know their internal structure. This is possible by creating context variables that allows access in a container-agnostic manner.

Pointers are invaluable while working with strings. You'll learn how to create dynamic strings using pointers. This will be shown with an implementation of a string class.

The next important topic you'll learn and implement will be function pointers. You'll understand how function pointers work and how we can simplify their syntax. You'll also master the complexity of creating arrays of function pointers and functions that return function pointers. On top of that, you'll be comfortable with functions returning pointer to functions that themselves return pointer to other functions. Confused? See the section on function pointers.

That's not all. You'll also learn how to create pointer to members (which have even a more complex syntax than function pointers).

Furthermore, you'll learn how to create callbacks through functions pointers. This course will show you how to optimize the callbacks through function objects. Function objects are more powerful than functions pointers as callbacks.We'll use this knowledge and apply it in many examples to reinforce the concept of pointers to functions.

This course also introduces some commonly used containers of the C++ standard template library (STL), such as std::array, std::vector & std::list. By the time you hit these topics, you'll already know how these are implemented internally. How about that.

This course relies on some modern C++ (C++11) features to simplify things, such as auto, std::initializer_lists, type aliases. Even if you don't know about these features, the course has videos on these topics to get you started. Additionally, there are four full length videos dedicated to discussion on move semantics.

I hope you enjoy this course.

Enroll now

What's inside

Learning objectives

  • Understand in depth how pointers work
  • Understand the applications of pointers
  • Understand efficient implementation of basic data structures
  • Understand how callback mechanism works through pointers and objects

Syllabus

Learn about basics of modern C++ & pointers

Introduction of the course.

Source Code for modern C++ lecture & introduction to pointers.

Read more

This lecture covers some basic features of Modern C++ (C++11/14). These features are used extensively in the subsequent lectures and make it easier to write code and make it more expressive.

Learn about the basics of pointers, stack, heap and data section.

This lecture will show an example of using pointers. We'll examine them using the memory window of Visual Studio.

Understand and implement static arrays on stack & heap

Source code for arrays section

Introduces static arrays (arrays that are created on stack, at compile time)

This lecture demonstrates usage of arrays and their representation in the memory.

Demonstrates how arrays can be passed as arguments into functions.

Demonstrates how arrays can be passed by reference into functions through templates.

A gentle introduction to standard library std::array.

Learn how to create dynamic arrays on heap through new operator. You'll also see how dynamic arrays are represented in the memory.

This video discussed multi-dimensional static arrays and their syntax along with pointers to such arrays. You'll also learn how to pass multi-dimensional arrays to functions.

Here, you'll learn how to create multi-dimensional arrays on heap using new and how they are represented in heap memory. 

Understand & implement dynamic arrays in depth

Provides the code for the dynamic array and the Noisy class. This class is used for debugging in dynamic arrays.
Note: Noisy class is provided for two different standards. If you're compiling your code with C++17 standard, include noisy_cpp_17.h. Otherwise, use both noisy_cpp_old.h & noisy_cpp_old.cpp.

To enable tracing with old noisy class, you've to define _DOTRACE macro in noisy_cpp_old.h header.

Revisits dynamic arrays on heap and discusses their advantages in comparison with static arrays. This lecture also explains the Dynamic Array project along with the important functions.

In this part, we'll implement different kinds of constructors in the dynamic array class.

Here, we'll add accessor functions (back, front, getat, etc).

This lecture explains implementation of important functions such as Add & Insert.

Here, we'll discuss how to implement the erase functionality in the dynamic array.

This is the start of four-part discussion on move semantics. Move semantics is a very important part of C++11 as it greatly improves the performance of the code. 

This part prepares the groundwork by explaining the basics of rvalue and lvalue references.

The second part demonstrates different function overloads based on value types.

Here, we'll discuss how copy semantics work.

In this part, you'll learn how to implement move constructor and assignment in the Integer class. You'll also understand when move semantics are used by the compiler for objects of the class. We'll also learn about the library function, std::move

In this lecture, we'll implement move and copy semantics in the dynamic array class and understand how this improves the performance of our code.

The dynamic array class has several issues due to usage of new[] operator. This video explains all these issues in depth.

Placement new is a very powerful operator for creating an object without allocating memory. Using this operator, this lecture demonstrates how it can help us overcome the issues in the dynamic array class.

This lecture builds explains and demonstrates how the placement new operator can be used to dynamically & efficiently grow a heap-based array.

We'll create a new dynamic array in this video and implement smart reallocation technique in it. We'll start by implementing constructors and a destructor.

Here, we'll implement the Add function in the new dynamic array class.

Discusses implementation of the Insert function.

We'll add some more functions in the array class and also fix some bugs.

This lecture revisits the pros and cons of arrays - both static and dynamic. It also proposes an alternative data structure called list, which we shall discuss in the next section.

Understand how pointers are used to implement singly linked lists

Source code for singly-linked list.

This lecture explains the basics of linked lists. You'll learn how pointers are used to create nodes which ultimately form a chain, called linked list.

We'll add the common functions in the list class, but implement them in subsequent videos.

We'll implement the Add function in this lecture.

In this video, we'll implement various constructors in the list.

In this video, we'll implement move and copy semantics in the list.

You'll learn how to insert a new element in the list, by creating a node and inserting at the correct position in the list.

You'll learn how to remove elements by erasing nodes from the list without breaking the chain of nodes.

To access the elements of the list, we expose the head pointer to the users. This is a violation of encapsulation and you'll learn how to prevent this. 

We'll further encapsulate the List class. We'll also add support for element access without exposing the node pointers.

Understand how ponters are used to implement doubly linked list

Source code for doubly-linked list

You'll understand the basic structure of a doubly linked list. We'll start adding common functions in a list class.

In this video, we'll implement a few accessor functions (Front, Back).

You'll learn how nodes are added to doubly linked list at the front and back.

In this video, we'll implement support for element access through the Position context class.

We'll complete the implementation of the constructors.

In this video, we'll implement the functions to remove elements at the front and back of the list.

Here, you'll learn how new nodes can be inserted in the list by implementing the Insert function.

In this video, we'll implement the erase function and learn how to remove nodes from the list at any position.

Use pointers to create dynamic strings and simplify string handling

Source code for Strings section.

Introduces the basic concepts of strings and how they're represented as arrays.

Shows the implementation of calculating the length of the string.

Shows the implementation of copying and joining/concatenating strings.

Shows how to create a duplicate of a string through dynamic memory allocation.

We'll put together the concepts learnt in the earlier videos of string and create a string class. This class will manage the memory allocation/deallocation automatically.

Understand the importance of function pointers and learn how to use them in different situations

Source code for function pointers.

This lecture introduces the concept of function pointers. 

Demonstrates function pointers with more examples.

Here, you'l learn how to pass function pointers as arguments to functions

This lecture explains how function pointers can be returned from functions as values.

More examples of function pointers as return values.

You'll learn how to create array of function pointers.

Shows how to return an array of function pointers from a function. You'll also learn how to create a dynamic array of function pointers on heap.

Simplify the complexity of pointer to member and learn how to use in various situations

Source code for Pointer to member section.

Introduces the syntax of creating pointer to a members of a class.

Explains how to create a pointer to a constant members of a class.

Here, you'll learn how to simplify the syntax of using pointer to members.

This lecture explains how to create pointers to static members of a class.

Learn about callbacks and their types

Source code for Callbacks section.

In this lecture, we'll discuss an example of a Find algorithm that will serve as the foundation for learning callback concept later.

Here, you'll learn how function pointers can be used as callbacks.

We'll see another example of function pointers as callbacks in this video.

This lecture demonstrates usage of member functions as callbacks through templates.

This video explains the basics of function objects.

In this lecture, you'll learn and understand how function objects are used as callbacks instead of function pointers.

We'll go deep into the internals of how the compiler invokes a function pointer and a function objects. Consequently, you'll come to appreciate the advantages of using function objects as callbacks.

You'll learn the key differences between function pointers and function objects as callbacks. You'll also learn how to choose between the two when you want to use a callback.

BONUS LECTURE

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Covers modern C++ features like auto, std::initializer_lists, and type aliases, which can simplify code and make it more expressive for developers familiar with modern C++ practices
Explores the implementation of a custom dynamic array similar to std::vector, offering insights into memory management and optimization techniques used in standard C++ libraries
Discusses move semantics, a crucial aspect of C++11 that significantly improves code performance, with four dedicated videos explaining rvalue and lvalue references, copy semantics, and move constructors
Examines the use of placement new and delete operators for direct object placement in memory pools, providing a powerful optimization technique for heap memory usage with user-defined objects
Introduces commonly used containers from the C++ Standard Template Library (STL), such as std::array, std::vector, and std::list, after learners have already explored their internal implementations
Focuses on C++ implementations rather than C, which may not be suitable for learners who are primarily interested in C or who need to maintain legacy C systems

Save this course

Save C/C++ Pointers & Applications to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in C/C++ Pointers & Applications with these activities:
Review C++ Basics
Reinforce your understanding of fundamental C++ concepts like variables, data types, and control flow before diving into pointers.
Show steps
  • Review your previous C++ notes and assignments.
  • Complete online quizzes on basic C++ topics.
  • Write simple C++ programs to practice syntax.
Read 'C++ Primer'
Strengthen your foundational C++ knowledge with a comprehensive guide covering essential concepts and syntax.
View C++ Primer on Amazon
Show steps
  • Read chapters covering basic C++ syntax, data types, and control flow.
  • Work through the examples and exercises provided in the book.
  • Relate the concepts learned in the book to the course material on pointers.
Pointer Arithmetic Exercises
Practice pointer arithmetic to solidify your understanding of how pointers interact with memory addresses.
Show steps
  • Solve pointer arithmetic problems on platforms like HackerRank or LeetCode.
  • Implement functions that manipulate arrays using pointer arithmetic.
  • Debug code snippets involving pointer arithmetic errors.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Create a Pointer Cheat Sheet
Compile a cheat sheet summarizing pointer syntax, common pointer operations, and potential pitfalls to aid in quick reference and knowledge retention.
Show steps
  • Gather information on pointer declaration, dereferencing, and arithmetic.
  • Organize the information into a concise and easy-to-understand format.
  • Include examples of common pointer usage scenarios.
  • Add a section on common pointer-related errors and how to avoid them.
Implement a Custom String Class
Build a custom string class using pointers to manage dynamic memory allocation, reinforcing your understanding of memory management and string manipulation.
Show steps
  • Design the string class interface with methods for common string operations.
  • Implement constructors, destructors, and assignment operators to handle memory allocation and deallocation.
  • Implement string manipulation functions like concatenation, substring, and comparison.
  • Test the string class thoroughly with various input scenarios.
Read 'Effective Modern C++'
Supplement your learning with a deep dive into modern C++ practices, particularly those related to memory management and resource handling.
Show steps
  • Read selected chapters focusing on move semantics, smart pointers, and resource management.
  • Implement examples from the book to solidify your understanding.
  • Compare and contrast the book's recommendations with the course's teachings.
Contribute to a C++ Project
Apply your knowledge of pointers and memory management by contributing to an open-source C++ project, gaining practical experience and collaborating with other developers.
Show steps
  • Find an open-source C++ project that aligns with your interests and skill level.
  • Identify a bug or feature request that involves pointer manipulation or memory management.
  • Implement a solution, following the project's coding standards and guidelines.
  • Submit your code for review and incorporate feedback from other developers.

Career center

Learners who complete C/C++ Pointers & Applications will develop knowledge and skills that may be useful to these careers:
Systems Programmer
The work of a systems programmer involves developing low-level software such as operating systems, device drivers, and embedded systems; and C and C++ are the languages of choice for this domain. A deep understanding of memory management, provided by this course on C/C++ pointers, is critical. The course’s focus on pointers, dynamic arrays, linked lists and memory pool management are directly applicable to the challenges faced by system programmers when they work close to the metal. A systems programmer will find the content on efficient memory management, dynamic data structures, and callbacks to be invaluable for creating high-performance, low-level systems. The ability to use placement new and implement custom data structures directly enhances a system programmer's ability to optimize system performance.
Operating System Developer
Operating system developers create the core software that manages computing resources, and they typically do this with C and C++, making this pointers course essential. This course provides a deep understanding of memory management, which is a core requirement for any operating system developer. The course's coverage of pointers, dynamic arrays, linked lists, and memory pools are directly relevant to building operating system components such as memory managers and process schedulers. An operating system developer will benefit from the course's emphasis on memory optimization, callbacks, and custom data structure design. The course greatly enhances the ability to create low-level, highly optimized code that is the hallmark of operating systems.
Firmware Engineer
Firmware engineers develop low-level software that directly interfaces with hardware, making them ideal candidates for this course on C/C++ pointers. Firmware engineers often use C and C++ to create efficient and responsive systems, and a deep understanding of pointers and memory management is critical when working at this low level. The ability to implement dynamic data structures and optimize memory usage through techniques taught in the course benefits them directly. A firmware engineer’s ability to create and manage dynamic memory and implement systems using callbacks is improved by this course. Furthermore, the course’s emphasis on memory pools and placement new provides a substantial advantage in resource management.
Embedded Systems Engineer
Embedded systems engineers develop software for devices with limited resources, and often use C and C++ where memory efficiency is key, making this course highly relevant. This course on C/C++ pointers provides foundational knowledge of how memory is allocated and managed using pointers. The practical implementation of dynamic arrays, linked lists, and other data structures are directly applicable to embedded systems. An embedded systems engineer will find the thorough understanding of pointers, memory management, and callbacks in this course to be extremely useful for creating robust and efficient software for resource-constrained devices. Understanding of placement new and memory pools further contributes to low-level resource management.
Software Developer
A software developer often works with C and C++, leveraging their powerful memory manipulation capabilities. This course on C/C++ pointers helps build a foundation in understanding how pointers work, which is essential for efficient memory management and implementation of complex data structures. The course’s coverage of dynamic array implementation, move semantics, linked lists, and function pointers provides a developer with tools to optimize code and performance. A software developer benefits greatly from the practical knowledge of optimizing memory usage and handling dynamic data crucial for building efficient and robust applications. Furthermore, an understanding of callbacks can help developers implement more flexible and modular systems.
High-Performance Computing Engineer
High performance computing engineers require the ability to optimize code for maximum efficiency often using C and C++, which makes this course on C/C++ pointers particularly beneficial. In their field, direct control of memory is key to writing high-performance applications. The course's focus on pointers as well as memory management, dynamic data structures, and move semantics provides the tools needed to develop efficient code. A high-performance computing engineer benefits from understanding how function pointers and callbacks work to implement flexible and modular systems, and they will appreciate the depth of coverage of data structures and their internal implementation. The course's attention to memory pools and placement new directly benefits tasks of optimizing code for high performance.
Robotics Software Engineer
Robotics software engineers often deal with real-time systems and direct hardware interaction, making C and C++ essential tools and thus making this course exceptionally helpful. This course on C/C++ pointers helps develop a necessary understanding of how memory allocation works and how to efficiently use available resources. The course's focus on dynamic arrays, linked lists, and custom memory management are directly relevant to developing algorithms for robot control, navigation, and perception. A robotics software engineer will benefit from the course's knowledge of function pointers and callbacks, which are important for managing complex interactions between a robot’s software modules. Furthermore, the ability to use move semantics, placement new, and memory pools can optimize robotics software performance.
Data Structures and Algorithms Engineer
Data structures and algorithm engineers specialize on efficient data structures and algorithms, and often implement them in C and C++. This course on C/C++ pointers directly discusses the implementation of core data structures, like dynamic arrays and linked lists, which is directly relevant to this role. The course’s focus on pointers, memory management, and move semantics is also critical for understanding the performance characteristics of different data structures. A data structures and algorithms engineer will benefit from the course’s coverage of function pointers and callbacks as these are important for algorithm design. This course greatly enhances knowledge of how to implement and optimize the data structures and algorithms needed for effective, efficient software.
Network Protocol Developer
Network protocol developers implement the communication protocols that enable devices to interact over a network, and often use C and C++ for efficient performance and direct hardware interaction. This course on C/C++ pointers provides critical knowledge of memory management, which is essential for managing network buffers and data packets. The course’s coverage of dynamic arrays, linked lists, and function pointers is directly relevant to creating network protocol implementations. A network protocol developer benefits from the course's coverage of callbacks as well as low-level memory management. The course's focus on memory pools and placement new allows for optimizing memory usage, particularly in high-throughput network devices.
Game Programmer
Game programming requires an understanding of memory management and performance optimization, making this course on C/C++ pointers highly beneficial. Game programmers often use C++ to handle the complexities of managing game assets and game logic, where direct memory manipulation and efficient data structures are paramount. The ability to implement dynamic arrays, linked lists, and custom memory allocation strategies taught in this course directly translate to optimizing game performance. A game programmer will benefit from the course’s coverage of function pointers and callbacks to implement game logic and event handling. The understanding of move semantics and dynamic memory management can also help optimize game assets for enhanced game performance.
Security Software Engineer
Security software engineers develop applications and systems for protecting data and networks, and they often work with C and C++ because of their performance and low level capabilities. This course on C/C++ pointers provides vital knowledge of memory management, which is crucial for writing secure code. The course’s focus on pointers, dynamic arrays, and memory pools will help with understanding common security vulnerabilities such as buffer overflows, memory leaks, and dangling pointers, and thus help in developing countermeasures. A security software engineer benefits from the course's knowledge of callbacks, move semantics, and dynamic memory management when developing secure, high-performance systems. A deeper understanding of memory management and associated risks contributes substantially to the development of more robust security protocols.
Compiler Engineer
Compiler engineers design and implement compilers, and a deep expertise in C and C++, especially memory management, underpins this work. This course on C/C++ pointers provides insights into how pointers work, how to manage memory manually, and how data structures are practically implemented. The course's coverage of dynamic arrays, linked lists, and function pointers provides direct insight into how these concepts are handled at a low level. A compiler engineer learns how features like move semantics, placement new, and memory pools are implemented by studying the course, which helps with designing better compilers. A compiler engineer benefits from a strong foundation in memory management, dynamic allocation, and data structures from this course in order to write improved code.
Database Systems Developer
A database systems developer is involved in designing and implementing the software that manages vast amounts of data, and C/C++ is often used for this purpose. Therefore, this course on C/C++ pointers provides tools for efficient memory handling and data structure implementation, which are vital for database performance. The course’s focus on dynamic arrays, linked lists, and custom memory allocation are crucial for designing efficient databases. A database systems developer benefits from the lessons on memory pools and placement new when optimizing the data storage and retrieval process. Furthermore, understanding function pointers and callbacks allows developers to create modular and flexible database systems.
Graphics Programmer
Graphics programmers develop software for rendering images and animations, often using C and C++ for performance-critical tasks. This course on C/C++ pointers provides a solid basis in memory management, essential for graphics programming, where efficient manipulation of large datasets such as textures and vertex data is crucial. The course’s coverage of dynamic arrays and memory allocation are directly applicable to this field. A graphics programmer benefits from understanding how to implement and optimize data structures using dynamic memory and pointers. The course's discussion of function pointers and callbacks also helps with event handling and graphics pipeline implementation.
Quantitative Analyst
Quantitative analysts develop models and algorithms for financial markets, and their work often involves performance-critical applications that are created with C and C++. This course on C/C++ pointers provides skills in memory management, optimization, and efficient data structures which are vital for high performance computing in financial analysis. The course’s lessons on dynamic arrays, linked lists, and function pointers help in creating complex models. A quantitative analyst benefits from the coverage of move semantics, placement new, and callbacks in order to create robust financial applications. These skills can help to make more effective and efficient models, which can be an invaluable advantage.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in C/C++ Pointers & Applications.
Provides in-depth coverage of modern C++ features, including move semantics and smart pointers, which are crucial for understanding advanced memory management techniques. It is highly relevant to the course's focus on pointers and their applications in C++11 and later. This book is best used as additional reading to expand on the concepts covered in the course. It is commonly used by industry professionals.
Provides a comprehensive introduction to C++ programming, covering fundamental concepts and advanced topics. It is particularly useful for students who need to strengthen their foundational knowledge of C++ before tackling pointers. This book is helpful in providing background and prerequisite knowledge. It is commonly used as a textbook at academic institutions.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser