Pointers in C / C++ [Full Course]

Wordpress sites

Pointers in C and C++ are often challenging to understand. In this course, they will be demystified, allowing you to use pointers more effectively in your code. The concepts you learn in this course apply to both C and C++.

✏️ Course developed by Harsha and Animesh from MyCodeSchool.
🔗 Read all about their amazing story here:
🔗 Check out the MyCodeSchool channel:
🔗 Check out the MyCodeSchool website:

⭐️ Course Contents ⭐️
⌨️ (0:00:00) Introduction to pointers in C/C++
⌨️ (0:10:29) Working with pointers
⌨️ (0:22:05) Pointer types, pointer arithmetic, void pointers
⌨️ (0:33:01) Pointers to Pointers in C/C++
⌨️ (0:42:21) Pointers as function arguments – call by reference
⌨️ (0:56:36) Pointers and arrays
⌨️ (1:05:18) Arrays as function arguments
⌨️ (1:18:10) Character arrays and pointers – part 1
⌨️ (1:32:49) Character arrays and pointers – part 2
⌨️ (1:42:49) Pointers and 2-D arrays
⌨️ (1:55:07) Pointers and multidimensional arrays
⌨️ (2:11:50) Pointers and dynamic memory – stack vs heap
⌨️ (2:29:14) Dynamic memory allocation in C – malloc calloc realloc free
⌨️ (2:36:48) Pointers as function returns in C/C++
⌨️ (3:02:01) Function Pointers in C / C++
⌨️ (3:13:57) Function pointers and callbacks
⌨️ (3:29:16) Memory leak in C/C++

⭐️ Special thanks to our Champion supporters! ⭐️
🏆 Loc Do
🏆 Joseph C
🏆 DeezMaster

Learn to code for free and get a developer job:

Read hundreds of articles on programming:

And subscribe for new videos on technology every day:

50 thoughts on “Pointers in C / C++ [Full Course]”

    1. no, it’s a wrong explanation ;)) it’s clear from the very first minutes even though video last 4 hour ;)) video is not outdated, bcs it was never valid ;))

  1. Siddharth Panjwani

    I’ve already seen this on the original channel and it helped a lot. I’m glad its finally getting the recognition as I think the channel is very underrated.

  2. Thank you!!! I’ve been trying to wrap my head around the concept of pointers for the longest time, and this video definitely makes it stick a lot better. When I was taking my programming courses, my instructor kind of just brushed over this topic, but this requires a deeper, more in-depth

  3. Very clearly explained. I did C programming in 1990 as a part of my university project (I am Mechanical Engineer). I thought that everything is forgotten, but when I watched this video, everything resurfaced as if I had studied all this just yesterday.

  4. This channel helped me a lot in clearing my fundamentals, I’m so happy to see that the code school is getting the recognition it deserves .. RIP legend

  5. The “Dynamic memory allocation” section should end at `2:46:57`, and the “Pointers as function returns” section should start at `2:46:58`.

  6. This guy is one of the best instructors I have heard on the web. Speaks very good English and explains things in a very logical, easy to follow manner. Superior instructor. Great job!

  7. Everytime he says thanks for watching, I so desperately want to thank him for teaching. You’re a legend, Harsha and you’ll never be forgotten 🙏

  8. Hamza Karabağ

    If you’re as confused as me after checking the size of A in the sumOfElements function (around 1:15:27) and finding that it yields 8 instead of 4, note that in x64 architectures pointers are assigned 8 bytes. Since A is technically a pointer in that context and that’s why you’ll get 8 bytes of size

    1. The size of other types will also change dependent on the settings of the compiler. Even comparing with the same CPU, some of these are simply choice and this is why we have the “size of A” function to check that they are acting as expected. For example a “long long int” default could be 32 or 64 or 128 bits depending on language compiler and target CPU, and you can manually change this compiler configuration. This is because you may be compiling the same source code several times for different CPUs. ie for some cases int is 16b, short is 8b, and both long and long long types are 32; for clang and gcc default for AMD64 is int=32 and long-long=128b, but you could add a compile time flag to change the int to 64b or everything to 32b.
      Float names are more standard so a double is 64bit everywhere I have looked. But the “long double” can often create a mistake, some interpret long-double as IEEE-754 float128, some simply ignore the long and use 64bit double; and others interpret long-double as an 80bit “extended precision” float; 80bit matches the x87 floating point hardware unit that is combined with some CPUs.
      And a few terrible implementations (*cough*python numpy*cough*) have been known to actually use 80bit when you use explicit “float128” or “float96” keywords in your source. These 80bit floats may actually be padded with zeros to use 12 or 16 bytes of memory (96 or 128bits) to keep the typical 4 or 8 byte alignment of memory addresses and cache lines, but the x87 math unit only uses 10 bytes.

  9. This was very helpful, thanks!  
    Here are some minor corrections:
    – At 0:41:00 : in the discussion of pointer-to-pointer, variable r should hold the address of q (=205), not the value of q (=215).
    – At 1:28:00 : print(c2[1]) is only possible via printf(c2 + 1) and this outputs ‘e’, not ‘l’.

    1. Ojas Maheshwari

      I don’t see any problem at 0:41:00, he outputted **r and ***r not just r. So it returned 225 and 6.

    2. @Ojas Maheshwari I thought the same, he wrote the wrong number on the chart. Look at the memory map he drew, the arrow points to 205 which is Q, but he wrote 215. But that should still end up giving you 225 once you de-reference 215.

  10. Thank you so much! I have completed the first hour and learned a lot! Thank you sir!!!!! God bless you all and your team for providing free content with outclass quality! Please keep up the good work. I am learning programming for a business project, and haven’t found any better video lecture so far. I even tried some payed courses but this is simply on the next level. Thank you again!

  11. What a gifted teacher!
    I know this stuff, but it was nevertheless a pleasure watching the entire video.

  12. In pointer to pointer concept : Value stored in “r” is 215 which I guess should be 205 if not mistaken 🙂BTW very well explained ! Use of pen and diagrams really helps to understand things better. And course content is very well covered. Lucky to have this in my library .🙏

  13. Note about doing stuff like:
    int* p;

    It kinda make sense to put the star next to the data type… because it’s an “Int pointer” named p. This is fine as long as you declare only one variable per line. Some people like to declare multiple variables at once. If you do so, only the first variable will be a pointer:

    int* p1, p2;
    p1 will be a pointer to an integer… But p2 is an integer. This is why you should put the asterisk on the variable name instead:
    int *p1, *p2;

    1. at 28:00 after defining p0 , i am unable to print p0….and also upon dereferencing it is giving weird outputs….someone please tell…

  14. I must express the greatest possible gratitude for this course. The material is comprehensive, well-thought out and superbly structured. All of my implicit questions (i.e. “I know that I don’t understand something, just not know what”) are vanishing rapidly, and I haven’t even finished the course yet! Thank you, thank you! To listen to this course was probably one of the best decisions I’ve made as a first year in university.

  15. 21thCenturion Android Gaming

    This was very helpful. It helps fill out some gaps while learning structures, and other concepts. Thank you very much to the team who made this. 👍💪😎🔭📡

  16. Chandradhar Rao

    Just like the programming language C, your videos and lectures are evergreen!

  17. I spent decades writing C/C++ code daily, and the best bit of advice anyone ever gave me stuck with me that entire time relating to pointers.
    Not sure if it is in this video, as I didn’t watch it all …

    When you are reading the declaration of a C/C++ variable, read it right to left in English and the meaning is obvious

    e.g. What is a variable defined as … int * const *
    Backward .. it is a Pointer to a constant pointer to an integer

    e.g. What is a variable defined as int [] **
    Backward .. it is a Pointer to a Pointer to an Array of Integers

    Easy 🙂

Comments are closed.