C/C++ Pointers & Applications
4.1 (97 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
932 students enrolled

C/C++ Pointers & Applications

Learn the applications of pointers such as usage in dynamic arrays, linked lists, function pointers, callbacks, etc
4.1 (97 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
932 students enrolled
Created by Umar Lone
Last updated 4/2020
English
English
Current price: $139.99 Original price: $199.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 7 hours on-demand video
  • 9 articles
  • 11 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • 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
Course content
Expand all 80 lectures 06:52:51
+ Introduction
5 lectures 20:00

Introduction of the course.

Preview 01:40

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

Source Code
00:02

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.

Preview 07:34

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

Introduction to Pointers
04:47

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

Examples of Pointers
05:57
+ Static Arrays
9 lectures 43:38

Source code for arrays section

Source Code
00:03

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

Array Basics
03:15

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

Examples of Static Arrays
03:27

Demonstrates how arrays can be passed as arguments into functions.

Array as Function Argument
04:26

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

Preview 06:15

A gentle introduction to standard library std::array.

Introduction to std::array<T>
05:08

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

Heap-based Arrays
06:47

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.

Multidimensional Arrays
06:57

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

Multidimensional Arrays on Heap
07:20
+ Dynamic Arrays
19 lectures 01:55:11

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.

Source Code
00:03

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.

Introduction
10:39

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

Constructors
05:31

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

Accessors
05:20

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

Modifiers
06:22

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

Element Erasure
07:10

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.

Copy/Move Semantics - Part I
05:04

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

Copy/Move Semantics - Part II
06:19

Here, we'll discuss how copy semantics work.

Copy/Move Semantics - Part III
08:03

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

Copy/Move Semantics - Part IV
06:10

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.

Copy/Move Semantics Implementation
05:10

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

Preview 04:59

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.

Placement new & delete
05:51

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

Preview 03:15

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.

New Dynamic Array I - Constructors
07:29

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

New Dynamic Array II - Add Function
05:45

Discusses implementation of the Insert function.

New Dynamic Array III - Insert Function
08:55

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

New Dynamic Array IV - Miscellaneous Functions
09:47

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.

Arrays - Conclusion
03:19
+ Singly Linked Lists
10 lectures 49:11

Source code for singly-linked list.

Source Code
00:02

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.

Linked Lists Introduction
03:19

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

Basic Functions
06:02

We'll implement the Add function in this lecture.

Modifiers - AddFront & AddBack
07:12

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

Constructors
05:53

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

Copy/Move Semantics
05:04

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.

Modifiers - Insertion
05:07

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

Modifiers - Erase
03:56

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. 

Issues
02:45

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

Element Access
09:51
+ Doubly Linked Lists
9 lectures 46:02

Source code for doubly-linked list

Source Code
00:02

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

Basic Functions I
05:35

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

Basic Functions II
04:32

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

Modifiers - Add
05:58

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

Accessors
04:37

We'll complete the implementation of the constructors.

Constructors
05:39

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

Modifiers - Front & End Removal
06:32

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

Modifiers - Insertion
07:13

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

Modifiers - Erase
05:54
+ Strings
6 lectures 35:21

Source code for Strings section.

Source Code
00:03

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

Basics
07:46

Shows the implementation of calculating the length of the string.

String Length
04:04

Shows the implementation of copying and joining/concatenating strings.

Copy & Join
08:38

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

Copy through Allocation
05:13

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.

String Class
09:37
+ Function Pointers
8 lectures 40:18

Source code for function pointers.

Source Code
00:03

This lecture introduces the concept of function pointers. 

Basics I
06:42

Demonstrates function pointers with more examples.

Basics II
04:32

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

Function Pointers As Arguments
08:34

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

Function Pointers As Return Values - I
07:23

More examples of function pointers as return values.

Function Pointers As Return Values - II
04:44

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

Arrays Of Function Pointers - I
03:55

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.

Arrays Of Function Pointers - II
04:25
+ Pointer To Member
5 lectures 15:57

Source code for Pointer to member section.

Source Code
00:03

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

Basic Syntax
06:47

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

Constant Member Functions
02:50

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

Simplifying Through Macros
03:50

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

Static Members
02:27
+ Callbacks
9 lectures 47:09

Source code for Callbacks section.

Source Code
00:02

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

Introduction
05:41

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

Function Pointers As Callbacks
07:20

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

Function Pointers Example
06:01

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

Member Function As Callback
07:00

This video explains the basics of function objects.

Function Objects
05:17

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

Function Objects As Callbacks
04:07

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.

Function Object Internals
05:37

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.

Function Objects Vs Function Pointers
06:04
Requirements
  • Basic knowledge of C & C++
  • Should understand basic syntax of pointers
Description

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!

Who this course is for:
  • Anyone who wants to increase their proficiency in C/C++ pointers
  • Anyone who wants to learn the applications of pointers
  • Anyone who wants to understand how basic data structures work internally