C++/Game Tutorial 30: Dynamic Arrays, Destructors!

Описание к видео C++/Game Tutorial 30: Dynamic Arrays, Destructors!

In this tutorial we learn how to make dynamic arrays and how to use destructors in our classes!

We also learn that a pointer can be accessed like an array! For example, if we have a pointer;
int *myInt = new int;
If we call myInt[3], its going to return us the value at the memory address (int)myInt + 3 * sizeof(int).

Fun Fact! ( You don't need to know this :P )
myInt[3];
is equivalent to
*(myInt + 3);
when you add 1 to an int *, it actually adds sizeof(int) to the value! Print it out and see for yourself!
printf("%d\n", (int)myInt);
printf("%d\n", (int)(myInt + 1));

Twitter:   / chillstepcoder  
Seed Of Andromeda Channel:    / dubstepcoder  
Seed Of Andromeda Website: http://www.seedofandromeda.com/

Комментарии

Информация по комментариям в разработке