Pointers in 16 Minutes | C++ For Java Devs Ep. 8

Channel:
Subscribers:
59,400
Published on ● Video Link: https://www.youtube.com/watch?v=w4JwOfV6J2k



Duration: 16:12
3,851 views
133


Join the Discord: https://discord.gg/4tHeAkxNg7

In this episode I explain how pointers work in C++. I begin by showing how the value stored inside a pointer is a hexadecimal memory address, which we can inspect using Visual Studio's debugging tools to see the contents. Then I show how you can modify the value stored at the address by using the dereference operator. After that I give a visual explanation of what is going on underneath all the code, with a brief introduction to the heap. Then I show the address-of operator and the pointer-to-member operator, and explain how to use each of these with pointers. Finally, I conclude with a challenge asking you to modify a vector using a function that returns nothing.

0:00 In This Episode
0:33 Syntax of a Pointer
1:08 Inspecting a Pointer
2:18 The Dereference Operator
3:21 Pointers Explained Visually
5:29 Mini Challenge: Pointer Swapping
7:24 Coding the Pointer Swap
9:32 Address Operator
12:33 Pointer to Member Operator
14:22 Challenge

---------------------------------------------------------------------
Website: https://ambrosiogabe.github.io/
Github: https://github.com/ambrosiogabe

Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :)

My Recommended Game Engine Books:
Game Engine Architecture: https://www.gameenginebook.com/
Game Physics Cookbook (Read this before the next physics book): https://www.amazon.com/Game-Physics-Cookbook-Gabor-Szauer/dp/1787123669
Game Physics (Ian Millington): https://www.amazon.com/Game-Physics-Engine-Development-Commercial-Grade/dp/0123819768
Game Programming Patterns (Free): https://gameprogrammingpatterns.com/

My Recommended Beginning Game Programming Books:
JavaScript Game Design: https://www.apress.com/gp/book/9781430247166

My Recommended Java Books:
Data Structures/Algorithms: https://www.amazon.com/Data-Structures-Algorithms-Java-6th-ebook/dp/B00JDRQF8C
LWJGL (Free, but I haven't read this thoroughly): https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content/







Tags:
gameswithgabe
games with gabe
c++
pointers
pointers in c++
dereference pointer
pointers explained
address operator
how pointers work in c++
how the heap works in c++
how to code in c++ for java developer
compiler options
msvc compiler options
linker options
msvc linker options
visual studio
setting up visual studio
c++ quickstart
c++ basics