C++ dynamic memory explained for beginners 🧠

  Рет қаралды 10,855

Bro Code

Bro Code

Күн бұрын

Пікірлер: 18
@BroCodez
@BroCodez 2 жыл бұрын
#include int main () { char *pGrades = NULL; int size; std::cout > size; pGrades = new char[size]; for(int i = 0; i < size; i++){ std::cout
@thechudson
@thechudson 4 ай бұрын
This helped me understand pointers so much more than your original video did. Not that your previous vid didn’t make sense, it just feels much more more practically applicable now compared to before. Much thanks
@dynamagon
@dynamagon Жыл бұрын
Hey do you think you could do an episode on std::vectors ? I think a lot of people could get a ton of use out of them.
@ngchn64
@ngchn64 5 ай бұрын
Thank you so much!! Wish I found this video sooner
@JackEvans-hf7qt
@JackEvans-hf7qt Жыл бұрын
//allocating dynamic memory to pointers and printing the no . of items specified by the user in c++ # include using namespace std; int main() { string *ptr= NULL; int size; string temp; coutsize; ptr=new string[size]; for(int i=0;i
@shivakumark1824
@shivakumark1824 2 жыл бұрын
TQ for your video
@willlagergaming8089
@willlagergaming8089 9 ай бұрын
#include int main () { int size; std::cout > size; char pGrades[size]; for(int i = 0; i < size; i++){ std::cout
@shervin9561
@shervin9561 10 ай бұрын
Heap and stack! thanks
@emilgmelfald
@emilgmelfald 2 ай бұрын
Why do you use NULL instead of nullptr? Is there an important difference between the two?
@heco.
@heco. 16 күн бұрын
NULL is basically the integer 0 but nullptr is a custom keyword made specifically for pointers. In this case, it wouldn't really matter what you use but it's good practice to use nullptr because it's more type safe.
@TheDreamN
@TheDreamN 3 ай бұрын
Would it be better to use vectors instead when unsure of the array size and what it would be?
@heco.
@heco. 16 күн бұрын
Vector it self uses heap memory. In most of the cases, using vector is certainly the best choice since it has a lot of benefits. The only benefit for using normal array in heap memory is that it costs less memory overhead and less processing time. Which is basically negligible. But you could notice it if you're working with very very large memory. So, yes you can use vector here and you should.
@Dazza_Doo
@Dazza_Doo 2 жыл бұрын
I see, this is where the New keyword came from, as you know C# doesn't run without it!
@TahaProgrammer
@TahaProgrammer Жыл бұрын
what will happen if i dont delete it
@masterali2837
@masterali2837 Жыл бұрын
A memory leak could happen it means the memory could disapear change other memory get corupted or if not enough memory avaible gets overiden by anotehr memory or vice versa
@HousseinAlDroubi
@HousseinAlDroubi 2 ай бұрын
Hey man.
@alejandrobh797
@alejandrobh797 Ай бұрын
hi
C++ recursion explained easy 😵
6:21
Bro Code
Рет қаралды 11 М.
Pointers and dynamic memory - stack vs heap
17:26
mycodeschool
Рет қаралды 1,4 МЛН
Não sabe esconder Comida
00:20
DUDU e CAROL
Рет қаралды 53 МЛН
Ouch.. 🤕⚽️
00:25
Celine Dept
Рет қаралды 27 МЛН
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 8 МЛН
2 MAGIC SECRETS @denismagicshow @roman_magic
00:32
MasomkaMagic
Рет қаралды 11 МЛН
C++ pointers explained easy 👈
5:16
Bro Code
Рет қаралды 33 М.
i wrote my own memory allocator in C to prove a point
5:23
Low Level
Рет қаралды 390 М.
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,2 МЛН
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 808 М.
you will never ask about pointers again after watching this video
8:03
Learn C memory addresses in 7 minutes 📬
7:01
Bro Code
Рет қаралды 67 М.
C++ CLASSES & OBJECTS explained easy 🧍
10:54
Bro Code
Рет қаралды 25 М.
C++ TIC TAC TOE game for beginners ⭕
19:09
Bro Code
Рет қаралды 24 М.
Não sabe esconder Comida
00:20
DUDU e CAROL
Рет қаралды 53 МЛН