#include int main () { char *pGrades = NULL; int size; std::cout > size; pGrades = new char[size]; for(int i = 0; i < size; i++){ std::cout
@afd1285 күн бұрын
thank you very much, ENG 🤍
@thechudson6 ай бұрын
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
@dynamagon2 жыл бұрын
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.
@dc3295Ай бұрын
bro youre an awesome teacher, thanks so much for everything
@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
@ngchn647 ай бұрын
Thank you so much!! Wish I found this video sooner
@shivakumark18242 жыл бұрын
TQ for your video
@Dazza_Doo2 жыл бұрын
I see, this is where the New keyword came from, as you know C# doesn't run without it!
@TheDreamN5 ай бұрын
Would it be better to use vectors instead when unsure of the array size and what it would be?
@heco.2 ай бұрын
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.
@shervin9561 Жыл бұрын
Heap and stack! thanks
@willlagergaming808911 ай бұрын
#include int main () { int size; std::cout > size; char pGrades[size]; for(int i = 0; i < size; i++){ std::cout
@emilgmelfald4 ай бұрын
Why do you use NULL instead of nullptr? Is there an important difference between the two?
@heco.2 ай бұрын
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.
@gvega622714 күн бұрын
How come when you print the value of your pointer pNum, you use *pNum, but when printing the values of pGrades, you do not use the de-referencing operator (i.e *pGrades[i])?
@ujeshasivaramakrishnan24647 күн бұрын
its because you need de referncing for data types that take up space like int or char while for a container type data type like arrays do not need dereferencing or pointing since we are already pointing to something in the array that is pGrades[i] index position 'i' and for the question of why we are using pointers is because we need to point to array itself as well and hence just for container types we dont need referncing but for int or char we do and pointers for everything PS i dont know if i am right but this is what i understood
@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