Uploaded July 2014 | Updated December 2026, 3 hours ago
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: twitter.com/ChillstepCoder
Seed Of Andromeda Channel: youtube.com/user/DubstepCoder
Seed Of Andromeda Website: seedofandromeda.com
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: twitter.com/ChillstepCoder
Seed Of Andromeda Channel: youtube.com/user/DubstepCoder
Seed Of Andromeda Website: seedofandromeda.com










