Arrays are Pointers | C++ For Java Devs Ep. 9

preview_player
Показать описание

In this episode I talk about how pointers and arrays are similar. I begin by showing how everything in C++ is just a block of memory, arrays are blocks of memory, pointers are blocks of memory, and variables are blocks of memory. Then I show how you can use this knowledge to treat arrays as pointers and vice versa. Finally I show the danger of C++ by setting a separate variable unintentionally by accessing an out of bounds index in an array.

0:00 In This Episode
1:01 Note About Deleting
2:30 Arrays and Pointers (Drawing)
7:35 Stack vs Heap (Static Allocation)
8:50 Coding Dynamic Arrays
12:14 Vectors and Functions
16:44 Array Out of Bounds (No Error...)
17:18 Horrible No Good Bugs
19:57 Challenge! (And nullptr)

---------------------------------------------------------------------

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:

My Recommended Beginning Game Programming Books:

My Recommended Java Books:
Рекомендации по теме
Комментарии
Автор

Gabe I cannot say this enough. If you like java, you will LOVE kotlin. It is the best language to ever grace God's green earth. Dedicate a week or two, to learning it and I promise you, you'll never be able to look at java the same it'll just be like an annoying little brother.

mrmaniac
Автор

Es triste porque, creer que un array es lo mismo que un puntero es uno de los mayores errores de personas que llegan a C/C++, y esto fomenta aún mas la confusión. Son tipos distintos y mezclarlos sin cuidado puede causar errores difíciles de detectar, como obtener un tamaño inesperado al intentar hacer sizeof() a un array que "decayo" en un puntero luego de pasarlo a una función (por ej.), o intentar hacer aritmética con el (lo cual no está permitido). Pasar a una función que espera un (char*) un (&array) de hecho es pasar otro tipo totalmente distinto, en concreto ((array*)[N]), y un buen compilador te lo advertirá, lo correcto es pasar (&array[0]) o directamente (array). El operador (*) tampoco funciona con arrays. Por lo tanto, son muy distintos.

elturco
Автор

Wait it's just me or you've missed an episode? Because the challenge at the beginning is not what you left us with in episode 8 it's completely different!

mightycoderx
Автор

please please continue the game engine series

sadmansakibkhan
Автор

Bro you were the only good java youtuber but you turned to c++ 😭🥺, and you stopped replying my comments cause you are too famous too remember I guess

buggybaka