We may earn an affiliate commission when you visit our partners.
Huw Collingbourne

To be an expert C programmer you need to master the use of pointers. This course explains pointers in real depth. It explains pointer variables, pointer arithmetic, indirection, memory allocation, how to create and maintain linked lists and how to use function pointers. In fact, by the time you finish this course, you will know pointers inside out. You will understand what they are, how they work and how to make sure that they don’t make your programs crash.

Read more

To be an expert C programmer you need to master the use of pointers. This course explains pointers in real depth. It explains pointer variables, pointer arithmetic, indirection, memory allocation, how to create and maintain linked lists and how to use function pointers. In fact, by the time you finish this course, you will know pointers inside out. You will understand what they are, how they work and how to make sure that they don’t make your programs crash.

This is not a course for beginners. It is aimed at programmers who already have a good working knowledge of C programming and who need to take the next step in mastering C by gaining a deep understanding of pointers.

If you’ve struggled with pointers and can’t quite figure out what all those ‘arrow diagrams’ really mean or what exactly is the relationship between pointers and addresses, this is the course for you. In a series of short, tightly-targeted lessons, you will learn all about:

  • computer memory and how pointers access it
  • how memory is allocated
  • why copying data using pointers can cause program errors
  • why some pointers are ‘generic’
  • what happens when you ‘cast’ pointers to specific types
  • how to create singly and doubly linked lists
  • how to use stacks and queues
  • how to avoid memory leaks and other common problems
  • ...and much more.

The source code for all the example programs is provided, so if you need to try out my code you can load it and run it in your preferred C IDE or code editor.

Enroll now

What's inside

Learning objectives

  • Pointers and addresses
  • Indirection and multiple indirection
  • Generic pointers and casts
  • Memory allocation and reallocation
  • Pointer arithmetic
  • Singly and doubly linked lists
  • Queues and stacks
  • Deep and shallow copying
  • Common pointer errors

Syllabus

What exactly are pointers? And why do they matter?

Who this course is for and what you will get out of it.

What is in the course and how should you study it?

Read more
Course Notes and FAQ
Source Code Archive

Pointers and addresses - how are they related?

How to create and use a pointer variable in C.

Dereferencing to get at the data that is ‘pointed to’.

What are pointers?

This document contains some brief notes on topics covered in Step One of the course. You may want to refer to use these notes as a revision aid or to help clarify important points from this section. 

Now we explore the relationship between pointers, addresses and data stored in memory

The address of the array is the same as the address of the first item in the array. Why is that important?

How can pointer values be displayed?

Let’s see how pointers and addresses work – and why arrays are special.

Pointers to pointers

Pointers to pointers to integers

Arrays of arrays of characters

What is **argv in the main() function?

Pointers to void

Setting aside storage space

How to allocate the right amount of memory for a specific amount of data

Why does your C compiler will complain about some functions?

How to clear memory before allocating

How to free memory that is no longer needed

How to change the size of a block of allocated memory

What does it mean when you add 1 to a pointer?

Using pointer arithmetic with arrays

But how much memory does a struct need?

Why the order of fields in a struct is important

Understanding that data types of a certain size are aligned on boundaries of that size

Pointer arithmetic works with complex types as well as simple types

Still confused by pointers? Here I show how to use your debugger to understand indirection

Here’s another example of how to use a debugger with multiple indirection – pointers to pointers to pointers, and see how they are stored in memory

The relationship between pointers, addresses and data stored in memory

This document contains some brief notes on topics covered in Step Two of the course. You may want to refer to use these notes as a revision aid or to help clarify important points from this section. 

Using pointers in linked lists, queues and stacks

Limitations of arrays and using linked lists as an alternative

How is a linked list different from an array?

Lists that include one pointer linking each element to the next one

Do you really always need to free memory?

Lists whose elements contain pointers to each adjacent element

An example showing how to create a simple double-linked list

Initializing a doubly-linked list not quite as simple as initializing a singly-linked list

A sample project showing a doubly-linked list

Queues are very common data structures in programming – here I explain what they are

Using a doubly linked list as a queue

A stack is another important type of data structure – here we see how it differs from a queue

You may need pointers with a stack, but you may not need a linked list

Adding and removing items to and from a stack

Iterating over list elements

Making a new copy of an existing queue

How would you delete an item from the middle of a list?

How would you add an item into a list?

What is a function pointer and what are they for?

The strange syntax for declaring a function pointer

How a single piece of code can call different functions using function pointers

Pointers in linked lists, queues and stacks

This document contains some brief notes on topics covered in Step Three of the course. You may want to refer to use these notes as a revision aid or to help clarify important points from this section. 

Errors, program crashes and how to avoid them…

Pointers are one of the major sources of error in C programs. But why?

When is a copy not a copy?

Sometimes a copy may not be what you think it is!

Allocating the wrong amount of memory is a recipe for disaster

When you cast a pointer you are not really changing anything. But an incorrect cast can cause problems even so

An example of a cast that didn’t work as expected

What happens if you free some memory twice?

When memory is allocated but not freed

What happens when you try to use memory that has already been freed?

Trying to access things that can’t be accessed

What happens if you use a pointer that doesn’t point to anything?

Some common sources of error in C programs.

This document contains some brief notes on topics covered in Step Four of the course. You may want to refer to use these notes as a revision aid or to help clarify important points from this section. 

That’s it! So where to next? Here are a few pointers…

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Explores memory allocation and reallocation, which are essential for efficient resource management in C applications
Covers singly and doubly linked lists, queues, and stacks, which are fundamental data structures used in various software applications
Teaches pointer arithmetic, which is a powerful technique for manipulating memory addresses and optimizing code performance
Examines common pointer errors, which helps learners avoid crashes and memory leaks in their C programs
Requires a good working knowledge of C programming, so beginners may need to acquire foundational skills before taking this course
Discusses deep and shallow copying, which are important concepts for managing memory and preventing data corruption

Save this course

Save Advanced C Programming: Pointers 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 Advanced C Programming: Pointers with these activities:
Review C Fundamentals
Solidify your understanding of fundamental C concepts before diving into pointers. This will make grasping the more advanced pointer concepts easier.
Show steps
  • Review data types, operators, and control flow in C.
  • Practice writing simple C programs using functions and arrays.
  • Work through online C tutorials or practice problems.
Read 'C Programming: A Modern Approach'
Supplement your learning with a comprehensive textbook on C programming. This book provides a solid foundation and covers pointers extensively.
Show steps
  • Obtain a copy of 'C Programming: A Modern Approach'.
  • Read the chapters related to pointers and memory management.
  • Work through the examples and exercises in the book.
Pointer Exercises on LeetCode
Reinforce your understanding of pointers through practical coding exercises. This will help you apply your knowledge and identify areas where you need more practice.
Show steps
  • Find pointer-related problems on LeetCode or similar platforms.
  • Attempt to solve the problems using pointers.
  • Analyze your solutions and learn from your mistakes.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Implement a Dynamic Array
Apply your knowledge of pointers and memory allocation by creating a dynamic array implementation. This project will solidify your understanding of these concepts.
Show steps
  • Design the interface for your dynamic array.
  • Implement the functions for creating, resizing, and accessing the array.
  • Test your implementation thoroughly.
Create a Pointer Cheat Sheet
Summarize key pointer concepts and syntax in a concise cheat sheet. This will serve as a useful reference for future programming tasks.
Show steps
  • Review the course materials and identify key pointer concepts.
  • Organize the information into a clear and concise cheat sheet.
  • Include examples and diagrams to illustrate the concepts.
Read 'Understanding Pointers in C'
Deepen your understanding of pointers with a book dedicated solely to the topic. This book provides detailed explanations and examples.
View Pointers on C on Amazon
Show steps
  • Obtain a copy of 'Understanding Pointers in C'.
  • Read the chapters relevant to your areas of weakness.
  • Experiment with the code examples provided in the book.
Help Others with Pointer Questions
Reinforce your knowledge by helping other students with their pointer-related questions. Explaining concepts to others will solidify your own understanding.
Show steps
  • Monitor online forums or discussion groups for C programming questions.
  • Answer questions related to pointers and memory management.
  • Explain concepts clearly and provide helpful examples.

Career center

Learners who complete Advanced C Programming: Pointers will develop knowledge and skills that may be useful to these careers:
Embedded Systems Engineer
An embedded systems engineer designs, develops, and tests software for devices that are not general-purpose computers. This role often requires a deep understanding of low-level programming concepts like memory management and pointer manipulation, which this course covers in detail. The course work on memory allocation, pointer arithmetic, and linked lists directly applies to tasks such as writing device drivers or firmware. A learner should take this course to gain expertise in programming at the hardware level. The course specifically addresses how pointers interact with memory, how to avoid memory leaks, and how to work with structures—all essential skills for an embedded system engineer.
Systems Programmer
A systems programmer is responsible for creating and maintaining the core software components of an operating system. This work involves intricate memory management and low-level resource control, where a strong grasp of pointers is essential. This course helps a prospective systems programmer by explaining pointer variables, pointer arithmetic, and memory allocation in depth. The curriculum on linked lists, queues, and stacks provides a detailed understanding of how data is structured and manipulated at the operating system level. This course is highly recommended for anyone seeking a role as a systems programmer, especially, if they want to prevent program crashes.
Firmware Engineer
A firmware engineer develops the low-level software that controls hardware devices. This role requires expertise in handling memory directly, using pointers, and interacting with hardware at a very basic level. This course is invaluable to a prospective firmware engineer, as it provides an in-depth understanding of how pointers work, how memory is allocated and deallocated, and how data structures like linked lists are implemented. The course also covers common pointer errors and how to avoid them. A firmware engineer should take this course to ensure they can skillfully handle the low level requirements of hardware control.
Operating Systems Developer
An operating systems developer works on the software that manages a computer's hardware and software resources. This role requires a detailed knowledge of memory management, data structures, and low-level programming concepts. This course, which explains pointers in real depth, is ideal for an operating systems developer. The course provides thorough coverage of pointer variables, memory allocation, linked lists, and function pointers, which are all pivotal for operating system development. Specifically, the content on avoiding memory leaks is directly applicable to creating robust system software. A prospective operating systems developer will greatly benefit from this course.
Device Driver Developer
A device driver developer writes low-level software that enables operating systems and applications to interact properly with hardware. This work requires a strong grasp of pointers, memory management, and hardware interaction. This course helps a prospective device driver developer by providing a deep understanding of how pointers work. The course work on memory allocation, pointer arithmetic, and linked lists is directly applicable when writing drivers to manage hardware resources. This course is excellent for a device driver developer, since it covers exactly the kind of low-level work that they would be doing.
Data Structures and Algorithms Engineer
A data structures and algorithms engineer focuses on the design, implementation, and optimization of data structures and algorithms. The course’s in-depth coverage of pointers, including pointer arithmetic and memory allocation, provides a solid foundation for implementing advanced data structures. This course also covers linked lists, stacks, and queues, which are fundamental data structures used in algorithms and systems programming. The course’s exploration of common pointer errors can also be very valuable. Someone who wants to be a data structures and algorithms engineer should take this course to understand low-level memory management.
Robotics Software Engineer
A robotics software engineer develops the software that controls robots. This often involves dealing with real-time data, controlling hardware interfaces, and implementing complex algorithms. The course’s focus on pointers, memory management, and data structures provides an understanding that is useful in robotics programming. Specifically, the coverage of linked lists and queues is helpful for managing sensor data and task execution. A robotics software engineer should take this course to build a foundation in low-level programming for robust robot behavior.
Compiler Developer
A compiler developer works on the software that converts human-readable code into machine-executable code. This type of work often involves manipulating data structures and memory at a low level, which requires a mastery of pointers. This course, which focuses on the finer points of pointer usage, helps a compiler developer understand how to manage memory effectively. The course's instruction on linked lists, queues, and stacks can provide a proper foundation for compiler design, often relying on these data structures. A compiler developer should take this course to gain a comprehensive understanding of pointer-based programming, which are key for efficient code generation and optimization.
High-Performance Computing Engineer
A high performance computing engineer develops software for computationally intensive tasks. This field often requires manual memory management to achieve maximal performance. This course explains in detail how memory is allocated and used, which is important for optimized application development. The course explains how to avoid memory leaks, and this is a useful lesson for high performance applications which cannot tolerate poorly written code. A role as a high performance computing engineer is a good fit for someone who has taken this course to understand how to use pointers to get the best performance from hardware.
Game Developer
A game developer writes code to bring video games to life. Many game engines are written in C or C++, where efficient memory management is critical. This course, with its strong focus on pointers, helps a game developer understand how to manipulate memory in a structured and performant way, which is significant for game programming. The knowledge gained from the course on linked lists, queues, and stacks is useful for managing game state and resources. A game developer should take this course to deeply understand how to manage data with pointers, in order to create more efficient and sophisticated game mechanics.
Software Performance Engineer
A software performance engineer analyzes software to find and fix performance bottlenecks. This job can involve a deep dive into memory usage and data structure management, which is where this course becomes helpful. This course explains in depth how pointers are used to access memory, and it explains how to allocate and free memory properly. The course also covers common pointer errors and how to avoid them. A software performance engineer will find that this course may be useful especially when dealing with debugging code related to memory.
Database Developer
A database developer is involved in the design and implementation of database systems, often writing code that interacts directly with memory and storage. While much of database work is abstracted, lower levels often require complex memory management using pointers for performance reasons. The explicit instruction on pointer variables, pointer arithmetic, and memory allocation can be directly used. This course especially helps a database developer by highlighting how copying data using pointers could lead to errors and how to use pointers to handle data structures like linked lists. A database developer will find this course useful to understand how to handle storage and retrieval.
Graphics Programmer
A graphics programmer develops the software that renders images and animations on a screen. This role often involves low-level control over memory buffers that store graphical data. The course's emphasis on pointer manipulation, memory allocation, and data structures can be greatly useful in developing high-performance graphics engines. For a graphics programmer, this course may help in the understanding of how to work with low-level memory management in advanced rendering techniques. This course is helpful for anyone seeking expertise in graphics programming, because it can improve memory efficiency.
Security Engineer
A security engineer works on protecting computer systems and networks from security threats. This often involves analyzing software for vulnerabilities, many of which are related to improper memory management and pointer usage. A security engineer benefits from this course’s focus on pointer errors, memory allocation, and the intricacies of pointer usage. Specifically, the course content on how pointers can cause program crashes is relevant for understanding how vulnerabilities can be introduced into software. Security engineers may find this course helpful in identifying and mitigating memory related security risks.
Networking Engineer
A networking engineer designs, implements, and maintains computer networks. While much of the job is configuration, a networking engineer may need to write software to interact directly with network hardware or implement custom network protocols. This course may be useful to a networking engineer for developing performant and reliable network applications that need direct control over memory. This course provides a detailed focus on pointer variables, memory allocation, and data structures like linked lists, which can be used in the development of network software. A networking engineer may find this course helpful to understand the intricacies of how to handle memory when writing network code.

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 Advanced C Programming: Pointers.
Provides a comprehensive and modern introduction to C programming. It covers all the essential topics, including pointers, in detail. It valuable resource for both beginners and experienced programmers looking to deepen their understanding of C. This book is often used as a textbook in university-level C programming courses.
Focuses specifically on pointers in C, providing in-depth explanations and examples. It covers advanced topics such as function pointers and dynamic memory allocation. It valuable resource for programmers who want to master pointers. This book is particularly helpful for understanding the nuances of pointer arithmetic and memory management.

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