#include int main () { char *pGrades = NULL; int size; std::cout > size; pGrades = new char[size]; for(int i = 0; i < size; i++){ std::cout
@thechudson4 ай бұрын
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 Жыл бұрын
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.
@ngchn645 ай бұрын
Thank you so much!! Wish I found this video sooner
@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
@shivakumark18242 жыл бұрын
TQ for your video
@willlagergaming80899 ай бұрын
#include int main () { int size; std::cout > size; char pGrades[size]; for(int i = 0; i < size; i++){ std::cout
@shervin956110 ай бұрын
Heap and stack! thanks
@emilgmelfald2 ай бұрын
Why do you use NULL instead of nullptr? Is there an important difference between the two?
@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.
@TheDreamN3 ай бұрын
Would it be better to use vectors instead when unsure of the array size and what it would be?
@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_Doo2 жыл бұрын
I see, this is where the New keyword came from, as you know C# doesn't run without it!
@TahaProgrammer Жыл бұрын
what will happen if i dont delete it
@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