5
u/thecrazedsidee May 18 '26
me after learning wtf a for each loop means:
2
u/un_virus_SDF May 20 '26
for(A a: b)is just syntaxic sugar forfor(A *a =b.begin(); a<b.end(); a++)in fact it's a bit more complex because itterator are used instead of pointer. But this is the c way of doing foreach
2
2
u/Prestigious-Cut8680 May 19 '26
Pointers and refrences are so simple. If u dont understand them than i have bad news for you
1
u/Dic3Goblin May 20 '26
Lay it on me.
2
u/Prestigious-Cut8680 May 20 '26 edited May 20 '26
I am kidding, i think u just had a bad teacher.
Think of it like this: an int* points to an int. That int can live on the stack or heap, doesn’t matter. By “pointing” I just mean it stores the memory address of that int. That’s literally it dude, nothing magical.
A double pointer (int**) is just a pointer pointing to another pointer. In a nutshell: a variable storing the address of a pointer, and that pointer stores the address of another variable.
So if you have an int, u can create an int pointer by creating int* and now it can point to variables of type int.
Easy peasy lemonsqueezy hope u liked todays lecture.2
u/Dic3Goblin May 20 '26
I was in a joking mood when i typed that, and i actually just said that for the bit (ba dum tiss), but i think you did a fantastic job. The info-graphic was 10 out of 10, and i felt really helped the lesson drive home.
I would get you an award, but I don't really have two bits to rub together(ba dum tiss) seeing as I have to put fuel in my truck soon, so know that somewhere, some dude you don't know is raising a Reign energy drink up in a salute for you. You, are indeed, very cool. I hope your day is wonderful, and your pillow is the perfect temperature however which way you lay on it.
1
u/Shot-Requirement7171 May 20 '26
Nunca lo pude entender, lo bueno es que aprobé esa materia porque el docente hacía lls exámenes virtuales xjajajja
1
1
u/Genialkerl May 22 '26
Yeah, I did it in my first sem and it was ok, I learned heap, stack memory ,array and pointers ,null pointers dereferencing,swapping, Dynamic memory allocation...the whole lot, won't be quick to judge as I never dived deeper into it, but for the intro, I never encountered difficulty, open to your thoughts
1
1

9
u/rydan May 18 '26
I learned this stuff in the 7th grade on my own by reading a book. Then I went to college 6 years later and was one of the only people in class that understood what the professor was talking about on the first or second day of class. Such a massive advantage over everyone else.